- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 05-18-2019 06:55 AM
(1169 views)
how to add extra rows to the existing data set in sas university edition?
ex- i have only 5 rows , how can i automatcally increase rows with empty values
how to make the 5 rows as 500 rows
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
please try this example, hope it helps
data have;
set sashelp.class end=eof;
output;
if eof then do i = 1 to 500;
call missing (name,sex,age,height,weight);
output;
end;
run;
Thanks,
Jag
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi and welcome to the SAS Communities 🙂
You can do something like this
data have;
input id $ var;
datalines;
1 1
2 2
3 3
4 4
5 5
;
data want(drop=i);
set have end=lr;
output;
if lr then do;
call missing (of _numeric_);
call missing (of _character_);
do i=1 to 495;
output;
end;
end;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
One idea: do a loop that counts to 100 for every observation read.
Note that just adding "empty" records only wastes space, but achieves nothing else that has any information value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PS I corrected your meaningless subject line.