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 ?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.