BookmarkSubscribeRSS Feed
Kman1234
Calcite | Level 5

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;

4 REPLIES 4
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
Kman1234
Calcite | Level 5
So i can not add to columns as i create the proc print?
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1118 views
  • 0 likes
  • 3 in conversation