The DHS Program User Forum - RDF feed
https://userforum.dhsprogram.com/index.php
SAS formatting programs
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11093&th=5609#msg_11093
From January-June 2016, I used the individual and men's recode for my data analysis
(Version 6). I'm using Malawi, Namibia, Zambia, and Zimbabwe (2010-2014).
I was able to read this into SAS with no problem.
However, now I must use the couples data for the same 4 countries and
along with my downloads came SAS programs with formats for each data
type (IR, MR, CR, etc.).
What is the purpose of these format programs? Am I using it to create a dataset
that is different from what I downloaded? If so, I tried changing the libname in
one of the format programs to point to where my downloaded data was located and that didn't work.
I ran my data without running the format program and I retrieved 0 observations.
Please assist as I can't find guidance on the DHS website on these programs.
]]>mwoolf2016-10-26T11:48:39-00:00Re: SAS formatting programs
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11098&th=5609#msg_11098
The format is provided merely as added documentation, to explain the data, and also to help make the data more meaningful/readable, especially when producing frequencies.
Please let us know if this answers your question.]]>Bridgette-DHS2016-10-26T18:55:45-00:00Re: SAS formatting programs
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11099&th=5609#msg_11099
Okay, that does help but if I want to use the
program, how should I go about using it? I'm having
trouble with the program since the original libname points
to someone else's computer. I modified the libname, and
ran the data assigning the formats.
However, I am having problems reading in the couples recode
data for Malawi (2010).]]>mwoolf2016-10-26T19:11:16-00:00Re: SAS formatting programs
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11103&th=5609#msg_11103
CREATING A PERMANENT SAS DATA SET 1.
In the LIBNAME statement (line 1 of the .SAS file), specify the path of the directory where the permanent SAS data set will be stored.
Example: LIBNAME user 'C:\COUNTRY'; To call up the format associated with the variables in the SAS data file, add the following statement in a blank line following line
1: OPTIONS FMTSEARCH=(user);
2. Create a permanent format catalog by adding the name of the library reference used in the LIBNAME statement, to the PROC FORMAT statement (in line 3) as follows: PROC FORMAT LIB = user;
In this example, a permanent format catalog will be stored in the directory called 'C:\COUNTRY'.
3. On the DATA statement line, precede the name of the data file being created with a period and the library reference name specified in the LIBNAME statement. The LIBNAME, period and data file name should form one word. DATA user.datasetname;
4. In the INFILE statement, add the path for the directory in which the .DAT file is located. INFILE 'C:\COUNTRY\datasetname.dat';
5. Add a RUN statement at the end of the .SAS file if there is no other SAS statement following the DATA step. RUN; A permanent SAS data file will be created in the specified directory, which will also contain the format catalog. The formats associated with the variables in the SAS data file are recalled in a new SAS session by adding the following statement to the SAS program: OPTIONS FMTSEARCH = (user); where user is the library reference name given in the LIBNAME statement. This statement should appear before the SAS data file is used in a DATA step or PROC statement.
CREATING A TEMPORARY SAS DATA SET
1. Delete the LIBNAME statement.
2. In the INFILE statement, add the path for the directory in which the .DAT file is located.
3. Add a RUN statement at the end of the .SAS file if there is no other SAS statement following the DATA step.
NOTE: The DATA statement (Data datasetname;) must always be on the line immediately before the very first ATTRIB statement. If the statement is at a different location, please MOVE it. Also, the default value for maximum record length is 256, but if the longest record in the dataset is greater than 256, you need to edit the INFILE statement. Please include the parameters INFILE {datasetname} LRECL={maximum record length} MISSOVER. INFILE 'C:\COUNTRY\datasetname.dat' LRECL=max.rec.length# MISSOVER;
Please let us know if this answers your question.
]]>Bridgette-DHS2016-10-27T09:51:51-00:00Re: SAS formatting programs
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11104&th=5609#msg_11104
I will work on this and share on the forum so that
others can use this info.
Thank you for the detailed explanation!]]>mwoolf2016-10-27T15:34:06-00:00SAS formatting programs update
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11124&th=5609#msg_11124
I realized that I'm getting error messages because
I downloaded the SAS files not ASCII files. Thus,
my log says, "file is in use".
So, if I want to use the SAS files (sas7bdat) I cannot
use this program at all?
Thank you for your assistance thus far.]]>mwoolf2016-10-31T16:03:51-00:00Re: SAS formatting programs update
https://userforum.dhsprogram.com/index.phpindex.php?t=rview&goto=11630&th=5609#msg_11630
Bridgette-DHS2017-01-18T12:20:30-00:00