Help using Base SAS procedures

Reading %

Reply
Regular Contributor
Posts: 229

Reading %

Hi i have a data set and the observation are having % how can i read it

data x;
input id sal;
cards;
3.4% 7.8%
1.2% 8.9%
run;

data y;
set x;
y=avg(id,sal);
run;
proc print;
run;


how can i read this i have kept $after the variable it was read in first data set bet for second how can i do the calculation .Help me
Super Contributor
Posts: 260

Re: Reading %

Hi.
You can use the PERCENT informat in the INPUT statement.
PS : the AVG function does not exist, its name is MEAN.
[pre]
data x;
input id Smiley TongueERCENT. sal Smiley TongueERCENT. ;
FORMAT _numeric_ PERCENT12.2 ;
cards;
3.4% 7.8%
1.2% 8.9%
;
run;

data y;
set x;
y=MEAN(id,sal);
run;
proc print;
run;
[/pre]
Olivier
Regular Contributor
Posts: 229

Re: Reading %

Thqs it worked
Ask a Question
Discussion stats
  • 2 replies
  • 110 views
  • 0 likes
  • 2 in conversation