Sas To Stata
Computing.SasToStata History
Hide minor edits - Show changes to output
Changed lines 1-4 from:
Here's how to save formats
to:
In SAS, PROC FORMAT is a convenient way to apply value labels to categorical variables. Unfortunately, SAS does not automatically save custom formats when a data set is saved. This makes it inconvenient to STAT/TRANSFER to convert to Stata.
Here's a solution:
Here's a solution:
Changed lines 36-37 from:
to:
If saved, STAT/TRANSFER can then use these formats when it does a conversion to another format, like Stata. My version of Stat/Transfer, automatically looks for the format file using a particular name and directory which can be set under Options. Not the most intuitive interface, but with trial and error it not too hard to figure out.
Changed line 40 from:
to:
Categories: [[!SAS]], [[!Stata]], [[!StatTransfer]], [[!Hacks]]
Changed lines 38-40 from:
http://sunsite.berkeley.edu/wikis/datalab/uploads/Computing/screen1.jpg"Stat/Transfer setup"
to:
http://sunsite.berkeley.edu/wikis/datalab/uploads/Computing/screen1.jpg"Stat/Transfer setup"
Tags: [[SAS]], [[Stata]], [[Stat/Transfer]], [[Hacks]]
Tags: [[SAS]], [[Stata]], [[Stat/Transfer]], [[Hacks]]
Changed lines 36-38 from:
STAT/TRANSFER can then use these formats when it does a conversion. My version of Stat/Transfer, automatically looks for the format file with using a particular name and directory which you can set under Options. Not the most intuitive interface, but use trial and error to get it right.
to:
STAT/TRANSFER can then use these formats when it does a conversion. My version of Stat/Transfer, automatically looks for the format file with using a particular name and directory which you can set under Options. Not the most intuitive interface, but use trial and error to get it right.
http://sunsite.berkeley.edu/wikis/datalab/uploads/Computing/screen1.jpg"Stat/Transfer setup"
http://sunsite.berkeley.edu/wikis/datalab/uploads/Computing/screen1.jpg"Stat/Transfer setup"
Changed line 36 from:
STAT/TRANSFER can then use these formats when it does a conversion. My version of Stat/Transfer, automatically looks for the format file with using a particular name and directory which you can set under Options. Not the most intuitive interface, but use trial and error to get it right.
to:
STAT/TRANSFER can then use these formats when it does a conversion. My version of Stat/Transfer, automatically looks for the format file with using a particular name and directory which you can set under Options. Not the most intuitive interface, but use trial and error to get it right.
Changed lines 3-4 from:
Here's a solution
to:
Here's how to save formats:
Changed lines 28-36 from:
;
to:
;
To use these formats, just include the following before your DATA step:
LIBNAME hd 'd:\public\HD';
options fmtsearch=(hd);
STAT/TRANSFER can then use these formats when it does a conversion. My version of Stat/Transfer, automatically looks for the format file with using a particular name and directory which you can set under Options. Not the most intuitive interface, but use trial and error to get it right.
To use these formats, just include the following before your DATA step:
LIBNAME hd 'd:\public\HD';
options fmtsearch=(hd);
STAT/TRANSFER can then use these formats when it does a conversion. My version of Stat/Transfer, automatically looks for the format file with using a particular name and directory which you can set under Options. Not the most intuitive interface, but use trial and error to get it right.
Added lines 1-28:
Formats (PROC FORMAT) are the most convenient way to apply value labels to categorical variable. Unfortunately, SAS does not automatically save custom formats when a data set is saved. This makes it inconvenient to STAT/TRANSFER to convert to Stata.
Here's a solution
LIBNAME hdformat 'D:\public\hd\formats';
PROC FORMAT library=hdformat;
VALUE MARCOHAB
1 ="Married, living with spouse"
2 ="Married, spouse absent"
3 ="Separated--Cohabiting"
4 ="Divorced--Cohabiting"
5 ="Widowed--Cohabiting"
6 ="Never married--Cohabiting"
7 ="Separate--Not cohabiting"
8 ="Divorced--Not cohabiting"
9 ="Widowed--Not cohabiting"
10 ="Never married--Not cohabiting"
;
VALUE MB2F
1 ="Married"
2 ="Separated, because of marital problems"
3 ="Divorced"
4 ="Widowed"
5 ="Never married"
7 ="Refused"
9 ="Inap/no answer"
99 ="Unknown"
;
Here's a solution
LIBNAME hdformat 'D:\public\hd\formats';
PROC FORMAT library=hdformat;
VALUE MARCOHAB
1 ="Married, living with spouse"
2 ="Married, spouse absent"
3 ="Separated--Cohabiting"
4 ="Divorced--Cohabiting"
5 ="Widowed--Cohabiting"
6 ="Never married--Cohabiting"
7 ="Separate--Not cohabiting"
8 ="Divorced--Not cohabiting"
9 ="Widowed--Not cohabiting"
10 ="Never married--Not cohabiting"
;
VALUE MB2F
1 ="Married"
2 ="Separated, because of marital problems"
3 ="Divorced"
4 ="Widowed"
5 ="Never married"
7 ="Refused"
9 ="Inap/no answer"
99 ="Unknown"
;