Data have;
infile datalines dsd dlm=",";
input name $;
datalines;
Programming,
,
,
Programming,
,
,
Programming,
,
,
;
run;
Hi, How would I get it so the output looks like:
Ex:
1. Programming
2. Is
3. Cool
4. Programming
2. Is
3. Cool
...
Thanks
No worries. See if you can use this as a template
Data have;
infile datalines dsd dlm=",";
input name :$20.;
datalines;
Programming
,
,
Programming
,
,
Programming
,
,
;
run;
data want;
set have;
if mod(_N_, 3) = 2 then name = 'Is';
if mod(_N_, 3) = 0 then name = 'Cool';
run;
hhmmm... is this what you are looking for?
Data have;
length name $15;
do j=1 to 1000;
do i=1 to 3;
if i=1 then do; name="Programming"; output; end;
if i=2 then do; name="Is"; output;end;
if i=3 then do; name="Cool"; output;end;
end;
end;
run;
I don't understand this. If that's your logic, then the word 'is' will be in the 2'nd row. And in the 5'th row. Which is not even?
My mistake, but hopefully I made it understandable when I said I was looking for an output that looked like
OBS name
1 Programming
2 Is
3 Cool
4 Programming
5 is
6 Cool
....
Sorry for the mix up
No worries. See if you can use this as a template
Data have;
infile datalines dsd dlm=",";
input name :$20.;
datalines;
Programming
,
,
Programming
,
,
Programming
,
,
;
run;
data want;
set have;
if mod(_N_, 3) = 2 then name = 'Is';
if mod(_N_, 3) = 0 then name = 'Cool';
run;
Anytime 🙂
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.