IS THE "COMMENTED" AND THE "NON SCOMMENTED" LINES DOING THE SAME THING IN THE BELOW CODE????
THANKS
data want;
set ints_exts2;
array ins int:;
array outs ext:;
do i = 1 to dim(ins);
if ins(i)^=. and outs(i)^=. then duration=sum(duration,outs(i)-ins(i)) /*UNCOMMENTED*/
*if 2=N(ins(i),outs(i)) then duration=sum(duration,outs(i)-ins(i)); /*COMMENTED*/
end
;
days = datepart(duration);
time = timepart(duration);
hrs=time/(60*60);
Total_vent_hours =days*24+ time/(60*60);
vent_days=Total_vent_hours/24;
run;
Not exactly as the Not missing, ^=., works for character variables while N(variables) requires all of the arguments to be numeric.
If you are dealing with mixed data types you might want CMISS(ins[i], out[i]) = 0
Thanks Reeza.
INS and OUTS arrays contain dates only. Can have missing values.
Wanted toi know if in that case both line output the same results??
Thanks
You could check with:
compare =(ins(i)^=. and outs(i)^=.) = (N(ins(i),outs(i)));
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.