BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

I need to insert two blank rows in my data set to use it for a graph. I am getting the output i need from data two, but is there a better way to program as there are more variables in actual data set. Thank you

 

output needed

a 1 c a
a
b 2 c a c 3 c a d 4 c a e 5 c a g 6 c a
data one;
input a $ b c $  d $;
datalines;
a 1 c a
b 2 c a
c 3 c a
d 4 c a
e 5 c a
g 6 c a
;

data two;
set one;
if _n_=1 then output;
if _n_=1 then do;b=.;c='';d='';output;end;
if _n_=1 then do;a='';b=.;c='';d='';output;end;
else output;
run;
3 REPLIES 3
novinosrin
Tourmaline | Level 20
data two1;
set one;
if _n_=1 then do;
output;
call missing(b,c,d);
output;
call missing(of _all_);
output;
end;
else output;
run;
PeterClemmensen
Tourmaline | Level 20

What kind of graph requires a blank row?

ballardw
Super User

@PeterClemmensen wrote:

What kind of graph requires a blank row?


I am guessing one that the data is coming from a spreadsheet and is structured poorly for SAS graphing and this an attempt to translate spreadsheet graphing practices to a SAS graphic procedure.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 9747 views
  • 2 likes
  • 4 in conversation