Hi Team, I have a variable called history which has 24 numbers in it. example (111221122121112121111121) - qualifies as Ever2 /455444443211113212211221 qualifies in Ever 4 Can you advise the logic to use to create flags like in the 'history' variable if it has numbers > 2( that comes in the complete series anytime not looking at the position)then Ever2 . I mean in that a particular variable i have 1 2months data...if the history variable has > 2 then Ever2=1, if it has >4 then Ever 4= 1; thanks for the help. examples of the records for history. 111111111111111111111111 888887654323221211111111 000000000000000000000000 000000000000000000000000 000000000088888888888888 111111111121111211111111 000000000000011111111111 000000000000000000000000 000000000000000000000000 888888888888888888888888 000000000000110111111211 000000000000000000000000 432232143221212212111111 000000000000000000000000 000000000000001111121111 000000000000000000000000 000000000000000000000000 111111211111111111112112
... View more
I'm trying to strip some operators from a string, leaving behind variable names. I'm using the following code which doesn't work. Is there some quoting needed?
%let expression = vara / (varb + varc);
%macro stripsym(string);
%sysfunc(translate(&string,,+-*/()));
%mend stripsym;
%put Output: %stripsym(&expression);
%put Desired: vara varb varc;
... View more
I have an admit date variable (admitdt) that needs to be brought in to define a few month and week variables but these have to be done in a separate step. Is there a way to create a macro in one data step that can be used in several? Do I just do a LET statement The admitdt format is mmddyy10.
... View more
I'm using SGPANEL, and would like to highlight certain panels that are interesting. I think I just want a way to set the wallcolor for each panel dynamically, is that possible?
Below code will make 3 panels, and all three will have the wallcolor set to yellow:
data have ;
input panelid x y ;
cards ;
1 10 10
1 20 20
2 10 15
2 20 15
3 10 20
3 20 10
;
proc sgpanel data=have ;
panelby panelid/ layout=panel;
styleattrs wallcolor="yellow" ;
series x=x y=y;
run ;
Is there a way I can make only the second panel have a yellow wallcolor?
I tried using a band plot in the background, which came close, but still extended the y-axis even though I set option NOEXTEND. I'm sure I could try other methods for adding a yellow bar in the background of second panel (e.g. REFLINE instead of a BAND), but before I go down that path, wondered if I'm missing an easier way.
My band plot approach:
data want ;
set have ;
if panelid=2 then do ;
lowerband=0 ;
upperband=100 ;
end ;
run ;
proc sgpanel data=want ;
panelby panelid/ layout=panel;
band x=x lower=lowerband upper=upperband /fillattrs=(color=yellow) noextend;
series x=x y=y;
run ;
Returned:
... View more