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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.