BookmarkSubscribeRSS Feed
FreelanceReinh
Jade | Level 19

@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.

data_null__
Jade | Level 19

@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:

@Ksharp:

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.  


 

data_null__
Jade | Level 19

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;

Capture.PNGCapture2.PNG

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 2127 views
  • 9 likes
  • 8 in conversation