Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to build a cumilitive loop

Status
Not open for further replies.

jslong99

Programmer
Aug 14, 2009
2
GB
Hi

I am trying to build a data set from scratch with a loop but am having no luck.

What I would like is for Sas to work out how many quarters between a year and now. So I have:

devqtrend=intck('quarter','01jan93'd,today());

devqtrend=67

Then I would like to create a dataset with a loop that writes a new record adding 1 to the previous field until reaching 67.

so I would end up with something like this:

Year devqtr
1993 1
1993 2
1993 3
1993 4
1993 5
...
1993 67


Is this possible?

Thanks for your time. Any help greatly appreciated.

Jamie
 
Here ya go:

Code:
data qtr;
Year = year('01Jan93'd);
devqtr = 0;
do while (devqtr < intck('quarter','01Jan93'd,today()));
	devqtr+1;
	output;
end;
run;

-Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top