BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vanpeltm1785
Obsidian | Level 7

Hello,

I realize this is probably super easy, but I don't know how....

Trying to create a table in sas that simply has number 1 - 90:


HEADER
1
2
3
4
5
etc...
SAS EG 7.13

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
bstarr
Quartz | Level 8
data want;
do HEADER = 1 to 90;
output;
end;
run;

 

error_prone
Barite | Level 11

Why do you need a dataset containing the numbers 1 to 90?

 

The problem can be solved with a small data-step, i recommend reading the sas documentation.

 

data work.number;
    length header 8;

    do header = 1 to 90;
        output;
    end;
run;
novinosrin
Tourmaline | Level 20

Hi, sounds like you are learner like me, so I am sharing my learning approach with the following experiments to understand operations, iterations, and explicit output:

 

/* using infinite increments with support from break and continue structures*/
data w;
	do i= 1 by 1;
		output;

		if i=90 then
			leave;
	end;
run;

/*while expression*/
data w1;
	do while(i<90);
		i+1;
		output;
	end;
run;

/*until expression*/
data w2;
	do until(i=90);
		i+1;
		output;
	end;
run;

/* start and stop with constant operands*/
data w3;
	do i=1 to 90;
		output;
	end;
run;

/* using operands*/
data w4;
	start=1;
	increment=1;
	stop=90;

	do i=start by increment to stop;
		output;
	end;

	keep i;
run;
;

 

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1309 views
  • 5 likes
  • 4 in conversation