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 🙂
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.