Hi guys,
Can someone help me to change the dataset according to the following?
Thank you.
Khalid
Nothing wrong with grouping them together. e.g.:
data want; set have; if v1=v2=v3=8 then call missing(of v1-v3); run;
Art, CEO, AnalystFinder.com
Whats the rule? All 8s or all the same value? What if you have two the same value and one is missing.
You can use MIN/MAX logic - if the min=max then the values are the same and you can use CALL MISSING to set variables to missing.
Useful functions:
N - returns number of non missing
NMISS - returns the number of missing
MIN - returns minimum value
MAX - returns max value
CALL MISSING() - sets variables designated to as missing - doesn't matter if they're character or numeric.
PS. Post data not in images but at least as text, ideally as a data step. We can't write code based on an image so that would mean typing out your dataset.
or just use something like:
data want; set have; array vars(*) v1-v3; if v1=v2=v3 then call missing(of vars(*)); run;
Art, CEO, AnalystFinder.com
Thank you for your comments. I want to consider 8s as missing when they are in all variables. For example, if v1=v2=v3=8, then
v1=v2=v3=missing. @Reeza
If v1=8 and v2=8 and v3 =8 then call missing(v1, v2, v3);
Nothing wrong with grouping them together. e.g.:
data want; set have; if v1=v2=v3=8 then call missing(of v1-v3); run;
Art, CEO, AnalystFinder.com
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.