Date: Wed, 25 Oct 2006 08:00:27 -0400
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: assign macro variable to number of columns
Arjen wrote:
> Hello SAS-L,
>
> I have a sas table with x columns. How would I create a macro variable
> &d that represents the number x? I need to use this &d in another
> macro that has the line "%do i = 1 %to &d".
Here are a few
- function
%let dsid = %sysfunc(OPEN, myTable);
%let D = %sysfunc(ATTRN (&dsid, NVAR));
%let rc = %sysfunc(CLOSE,&dsid);
- SQL
nvar into: D from DICTIONARY.TABLES where libname= and memname=
or
count(*) into :D from DICTIONARY.COLUMNS where libname= and memname=
--
Richard A. DeVenezia
http://www.devenezia.com/
|