I have run the following code below to make gender display male and female and if its 1 display yes and 0 = no
what i want to do is in one table add a extra column that would display the original value of the formatted data.Every time i try adding the coloumn
OrgGender and OrgMarried it gives me error messages.
PROC FORMAT;
VALUE FMTMARRIED 0="No"
1="Yes";
VALUE $FMTGENDER "F" = "Female"
"M" = "Male";
RUN;
PROC PRINT DATA="/folders/myfolders/CourseWork/SURVEY";
VAR SUBJECT MARRIED GENDER;
FORMAT MARRIED FMTMARRIED. GENDER $FMTGENDER.;
RUN;
@Kman1234 wrote:
I have run the following code below to make gender display male and female and if its 1 display yes and 0 = no
what i want to do is in one table add a extra column that would display the original value of the formatted data.Every time i try adding the coloumn
OrgGender and OrgMarried it gives me error messages.
You want to add this extra column in the data set, or in PROC PRINT? I think it has to be done in the data set, and then you can PROC PRINT it.
@Kman1234 wrote:
So i can not add to columns as i create the proc print?
Correct. @Kurt_Bremser correctly points out that PROC REPORT will allow this without first creating a new column in the data set.
PROC REPORT is more flexible; you can define an alias for a variable and use this without the format.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.