How to insert a blank observation alternatively or every two observations or specified?
Try next code;
data want;
set have;
output;
if mod(_N_,2) = 0 then do;
call missing(_ALL_);
output;
end;
run;
change the MOD() 2nd argument to insert blank observation as desired.
The tool to enter a blank observation depends on your source and target -
is it a dataset or a report ? do you have ID (key) variables?
and - why do you want to insert the blank observation? what is the goal ?
insert a blank observations alternatively or every 2 observations for existed dataset
Try next code;
data want;
set have;
output;
if mod(_N_,2) = 0 then do;
call missing(_ALL_);
output;
end;
run;
change the MOD() 2nd argument to insert blank observation as desired.
Thank U very mucH...
Please mark @Shmuel's answer as correct.
Depends.
Using a do loop op with an explicit output statement and CALL MISSING() is easier option for a dataset. If it's a report there are other options. I suggest you expand upon what you're looking to accomplish.
Any takers that we will next see a request from OP on how to insert values from another data source into those blank rows?
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.