BookmarkSubscribeRSS Feed
Ayooo1
Obsidian | Level 7

This might be a simple question but I would to replace the blank with a zero, how can I do that? The picture is the data after transposed.

data Merged_CP (keep= DoseC_P EXDSTXT SEX);
set listing2_1;
by EXDSTXT;
retain COUNT PERCENT EXDSTXT SEX;
length DoseC_P $20;
DoseC_P= strip(put(COUNT,comma12.)||''|| put(-PERCENT/100,percent7.1));
run;
proc sort data=Merged_CP;
by SEX;
run;
proc transpose data=Merged_CP out=EXDM (drop=_NAME_);
by SEX;
id EXDSTXT;
var DoseC_P;
run;
proc print data=EXDM;
run;

Ayooo1_0-1671041135114.png

 

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

Obviously, there are way to do this. 

 

However, if your end goal is to simply create a frequency table with percentages, then there are better ways to go.

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
  • 1 reply
  • 653 views
  • 0 likes
  • 2 in conversation