@hashman wrote:
As it was @FreelanceReinh who ideated using CALL STDIZE for this kind of purpose in the first place and hence must be quite well versed on the subject, maybe the original inventor will chime in with something instructive upon seeing the reference I included in this sentence.
Neither "well versed," I'm afraid, nor "the original inventor" (as shown by data_null__'s much older post). 🙂
In fact, I believe it was the first and only time that I used CALL STDIZE in that thread in July. I had just gone through the list of CALL routines (knowing that some of them can change the values of several variables in a single call) until I found one that did the job.
For @Midi's task the UPDATE statement (as suggested by data_null__) seems more natural to me than a CALL routine which was actually designed for a different purpose.
@hashman I was thinking that perhaps one could use METHOD=IN(dataset) to somehow communicate a different replacement value for missing values. I do now know how it all works but maybe something you might want to try.
@hashman wrote:
Methinks you've misunderstood me. I meant that it would be nice if proc STDIZE allowed to set some specified variables to one value and some other specified variables - to a different value, all in a single pass through the input data.
You can use the UPDATE statement to accomplish this without too much work.
data have ;
input user_id max_item tot_item max_days min_days ;
cards ;
1452 12 20 50 10
1460 . . 20 5
1465 10 12 . .
1470 . . . .
;;;;
run;
proc print;
run;
data master / view=master;
set have(keep=user_id);
retain max_item tot_item 1 max_days min_days 0;
run;
data missing2value;
update master have;
by user_id;
run;
proc print;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.