Hi,
Apologies if I was unclear.
Lets say I have a data which has some scores like 101, 102, 103,104,201,203,204.
Post this I did a Proc Rank to make 10 deciles and look at the distribution.
Code-
PROC RANK DATA=all (keep = scr ) OUT=all1 (keep = scr RSCORE) GROUPS=10 ;
VAR scr;
RANKS RSCORE;
RUN;
Post this I need to define a range that a particular deciles takes, so have done
Code-
PROC MEANS DATA=ALL1 NOPRINT;
VAR scr ;
BY RSCORE ;
OUTPUT OUT=ALL2
MIN=MINSCORE MAX=MAXSCORE ;
RUN;
DATA ALL3;
SET ALL2;
format RANGE $9.;
if RSCORE = . then do; RSCORE1 = 'MISSING';RANGE = 'MISSING';
end;
else do;
do i = RSCORE;
if RSCORE = (i) then do;
call symput ('MIN'||compress(i),compress(MINSCORE));
call symput ('RSCORE'||compress(i),compress(RSCORE));
call symput ('MAX'||compress(i),compress(MAXSCORE));
RSCORE1 = RSCORE;
RANGE = compress(MINSCORE||"-"||MAXSCORE);
end;
end;
end;
rename _FREQ_ = F;
run;
%PUT _GLOBAL_;
Once I have the range of each decile, I was hoping to impose that on same variable, however the source and data is different. The objective is to compare the distribution within deciles for these 2 sources.
So possibly I was hoping to define the deciles manually on the other dataset through the max and min macro variables that have been generated above and then use a proc sql to get the count for each range.
So I am stuck at a point where I am trying to figure out the way to impose the range on new data with &Max and &Min (these will be dynamic based on deciles that gets created and remember we might not get exact same ranks as we mentioned, since at times the 2 deciles are grouped withing one.
Regards,
Tejeshwar
Message was edited by: tejeshwar
... View more