The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Data » Dataset access » Restructuring Healthcare data
Restructuring Healthcare data [message #7104] Mon, 24 August 2015 03:13 Go to next message
JREY is currently offline  JREY
Messages: 13
Registered: August 2015
Member
Hi, everyone. I am examining health care utilization in the Philippines using the data using the NDHS household questionnaire. In the questionnaire the household respondent was asked if there was any member of the household who visited a health facility for consultation/advice or treatment anywhere. For each member who visited a health facility, the reason for consultation and the type of treatment received was asked. I would like to create a dataset where each household member has an information on these health care indicators, but I find it hard to structure the data in order to come up with my desired dataset. Could anyone please help me on this? Thank you.
Re: Restructuring Healthcare data [message #8111 is a reply to message #7104] Tue, 25 August 2015 07:48 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Are you a Stata user?
Re: Restructuring Healthcare data [message #8112 is a reply to message #8111] Tue, 25 August 2015 08:05 Go to previous messageGo to next message
JREY is currently offline  JREY
Messages: 13
Registered: August 2015
Member
I use STATA and SPSS.
Re: Restructuring Healthcare data [message #8118 is a reply to message #8112] Tue, 25 August 2015 12:26 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Following is a response from Senior DHS Stata Specialist, Tom Pullum:

I can understand why you are having difficulty. I see that this information was not coded onto the PR file in an efficient way. Every record in the household has all the information about the visits of all the members. It would have been better to code the information about, say, the person on line 3, just onto line 3. I think the best way to deal with this is to separate the information you need out, organize it by line number, and then merge back with the PR file.

The attached program will do this. It is a text file; you will probably want to put it into the Stata do file editor. You will need to change the paths. You will want to add more variables; I have shown where to do this.

The program puts the health information about each person onto that person's record. The file will only include the specific people who have had a visit. Let me know if you have questions.
Re: Restructuring Healthcare data [message #8121 is a reply to message #8118] Wed, 26 August 2015 04:22 Go to previous messageGo to next message
JREY is currently offline  JREY
Messages: 13
Registered: August 2015
Member
Thank you very much. This is very useful!
Re: Restructuring Healthcare data [message #8123 is a reply to message #8121] Wed, 26 August 2015 06:55 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Also from Tom Pillum:


I realized that there is a simpler and more direct way to do the same thing that was described in my previous response. This Stata program will also put the variables sh209, sh210, etc., onto the record for the correct person in the household, but without requiring a merge. The result should be the same.

[Updated on: Wed, 11 November 2015 11:47]

Report message to a moderator

Re: Restructuring Healthcare data [message #8131 is a reply to message #8123] Thu, 27 August 2015 05:00 Go to previous messageGo to next message
JREY is currently offline  JREY
Messages: 13
Registered: August 2015
Member
Thanks again for this command file.

I am also interested in creating a similar file for each member in the household who were sick/injured in the last 30 days.I am using the command that you sent but replaced the variables with the relevant ones. However, I got stuck in the looping command after I generated the seqno variable. I changed the sequence number to 12 and the person's line number to sh203, but it is still not working. Could you please help me on this?

Thank you.

Re: Restructuring Healthcare data [message #8149 is a reply to message #8131] Fri, 28 August 2015 13:38 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Another response from Tom Pullum:

Please try the attached program. The main problem is that some of the indexed variables, such as sh203, have indices with a leading 0--for example, 01, 02, 03, rather than 1, 2, 3. Stata has a very powerful rename command, so you need to include " rename *_0* *_* " to get rid of those 0's.

Hope this will work.

Re: Restructuring Healthcare data [message #8160 is a reply to message #8149] Mon, 31 August 2015 04:44 Go to previous messageGo to next message
JREY is currently offline  JREY
Messages: 13
Registered: August 2015
Member
Thank you very much for your help!

Does it make sense to merge the "sick/injured" file and the "healthcare utilization" file into one dataset using the hv001 hv002 and hvidx as the ID?

Again thank you very much!
Re: Restructuring Healthcare data [message #8230 is a reply to message #8160] Fri, 18 September 2015 14:15 Go to previous messageGo to next message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
Another response from Tom Pullum:

Yes, if you do the kind of reshaping I suggested earlier for both, then you can merge them back together. It would also be possible to reshape both types of variables within a single program. Either way would work.
Re: Restructuring Healthcare data [message #8235 is a reply to message #8230] Sat, 19 September 2015 00:29 Go to previous messageGo to next message
JREY is currently offline  JREY
Messages: 13
Registered: August 2015
Member
Thank you very much!
Re: Restructuring Healthcare data [message #8570 is a reply to message #8235] Tue, 17 November 2015 09:14 Go to previous message
Bridgette-DHS is currently offline  Bridgette-DHS
Messages: 3016
Registered: February 2013
Senior Member
You are welcome.
Previous Topic: Access to calendar data
Next Topic: Records missing in child survey for specific clusters
Goto Forum:
  


Current Time: Thu Mar 28 07:49:47 Coordinated Universal Time 2024