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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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