Hello
I am using proc univariate to calculate percentiles 10,20,30,40,50,60,70,80,90,100
The outcome data set is called pctls and is getting the values
Data pctls;
input REVENUEpct10 REVENUEpct20 REVENUEpct30 REVENUEpct40 REVENUEpct50 REVENUEpct60 REVENUEpct70 REVENUEpct80 REVENUEpct90 REVENUEpct100;
cards;
0 0 0 4 94.4325 1642.59 7241.93 18418.335 44282.98 27846721.81
;
Run;
Then I want to build formats
proc transpose
data=pctls
out=p_long;
var _all_;
run;
data cntlin;
set p_long;
length label $100.;
fmtname = "RevenueFmt";
type = "N";
start = ifn(_n_ = 1,0,lag(col1));
end = col1;
label = catx(" ","group_Revenue",_n_,"start:",start,"end:",end);
keep fmtname type start end label;
run;
proc format cntlin=cntlin;
run;
The problem is values 0-0 are overlapped.
What do you suggest to do in order to solve this problem and build the format well?
So this means that 30+ percent of your population have a zero value. I would discard the lower percentiles having a zero value:
data p_long2;
set p_long;
by col1,
if last.col1;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.