BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hey, I'm new to SAS and am stuck. The following is part of my coding. Columns Score and Denominator are showing up as character values, while Numerator is showing up as numeric. I realize I have the character symbol in the length statement, but the statement won't run otherwise.

How do I turn Score and Denominator into numeric?

How to I format the percentage so that it's numeric yet still has the % symbol?

data CMS.cms_database_sas;
length Provider_Number $ 8 Hospital_Name $70 Condition $ 29
Measure_Code $ 10 Measure_Name $ 174 Score $ 4 Sample
$ 13 Footnote $ 5;
infile 'CMS_database.csv' dlm=',' dsd missover lrecl=350;
input Provider_Number $ Hospital_Name $ Condition $ Measure_Code
$ Measure_Name $ Score $ Sample $ Footnote $;
Denominator = scan(Sample,1,'');
Numerator = (denominator*((scan(Score,1,'%'))/100));
format numerator 4.
denominator 4.;
run;
proc print data=CMS.cms_database_sas;
var Provider_Number Measure_Code Score Denominator Numerator;
where Score NE ' ';
run;
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Your code either must declare the variables as numeric or create a different named variable and my suggestion is to use the INPUT function to assign the new variables (or you can let SAS to the conversion in an assignment statement but I don't recommend that technique).

Scott Barry
SBBWorks, Inc.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 608 views
  • 0 likes
  • 2 in conversation