I have a table like this
Ac1 Ac2 Ac3 ZDS
Stoffwechsel Cycle osg 9.05.02.
Stoffwechsel Cycle osh 9.05.02.
Stoffwechsel Cycle 9.05.02.
Stoffwechsel Cycle osg 9.05.02.
I just want from SAS to replace the ZDS value when Ac2 = Cycle and Ac3 is missing at the same time (in this cas at the third line), How to do that what to write in SAS?
I tried
if Ac2 = Cycle and Ac3 = " " then ZDS = 9.05.04.;
run;
but it didn"t work
Many thanks in advance
Try :
if Ac2 = 'Cycle' and missing(Ac3) then ZDS = "9.05.04.";
Is ZDS supposed to be a SAS DATE value? (if so really should use a 4 digit year display format)
The only way to use a literal date value in SAS is to use the "ddMONyy"d or "ddMONyyyy"d construct.
So if you want a date that would be 9 May 2002 use "09May2002"d, if you want 5 Sep 2002 use "05Sep2002"d.
Choice of single or double quotes is yours.
Have you tried the code suggested by @r_behata ?
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!
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.