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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 624 views
  • 0 likes
  • 2 in conversation