LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 24 Dec 2007 07:27:48 -0800
Reply-To:   ash007 <RamsamyAshley@GMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   ash007 <RamsamyAshley@GMAIL.COM>
Organization:   http://groups.google.com
Subject:   Re: recover the number of item of a list
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Dec 24, 3:01 pm, nos...@HOWLES.COM ("Howard Schreier <hs AT dc-sug DOT org>") wrote: > On Mon, 24 Dec 2007 05:03:09 -0800, ash007 <RamsamyAsh...@GMAIL.COM> wrote: > >On Dec 24, 6:11 am, nos...@HOWLES.COM ("Howard Schreier <hs AT dc-sug > >DOT org>") wrote: > >> On Sun, 23 Dec 2007 14:40:18 -0800, ash007 <RamsamyAsh...@GMAIL.COM> wrote: > >> >please, how recover the number of the item of a list, my code doesn't > >> >work : > > >> >%LET LISTEVA=%STR(%SYSFUNC(COMPBL(&NAMELIST.))); > >> >%PUT &LISTEVA.; > > >> >DATA _NULL_; > >> > RETAIN I 1; > >> > TMP = %SYSFUNC(SCAN(&LISTEVA,I)); > >> > DO WHILE (TMP NE ' '); > >> > I+1; > >> > END; > >> > NBVA=I; > >> > PUT NBVA; > >> >RUN; > > >> >thank. > > >> >ash007. > > >> I presume that &NAMELIST comes from the code which Art suggested. Why not > >> mine the vein which he suggested and get the count as well as the list using > >> SQL and DICTIONARY.COLUMNS? To illustrate: > > >> proc sql noprint; > > >> create table namelist as > >> select name > >> from Dictionary.Columns > >> where libname eq "SASHELP" and memname eq "CLASS"; > > >> %symdel namelist; > >> select name into :namelist separated by ' ' from namelist; > > >> %symdel nbva; > >> select count(name) into :nbva from namelist; > > >> drop table namelist; > > >> quit; > > >thank it is working ! > > >in the same vision, how can I obtain the list of the variable of a SAS > >table following by his length. > > >example : VAR1 18 VAR2 23 VAR3 78 > > What have you tried? Are your difficulties in finding the information (the > lengths) or in generating the list?

I have manage to have a table with the name of variables and his length but I don't know how to put them in a macro variable.

PROC SQL NOPRINT;

CREATE TABLE NAMELIST2 AS SELECT NAME,LENGTH FROM DICTIONARY.COLUMNS WHERE LIBNAME EQ "WORK" AND MEMNAME EQ "TABLE1";

%SYMDEL NAMELIST2; /* POUR SUPPRIMER LA MACRO VARIABLE */

SELECT NAME,LENGTH INTO :NAMELIST2 SEPARATED BY ' ' FROM NAMELIST2;

* DROP TABLE NAMELIST2; /* POUR SUPPRIMER LA TABLE NAMELIST1 */

QUIT;

thank for help.

ash007.


Back to: Top of message | Previous page | Main SAS-L page