From: Ranjhana on
Hi,

I want to automate importing a text file whose layout may not be
standard for every refreh.
for eg: today i have var1-var10 . tomo i might have var1-var15. my
code should automatically realise that there are 5 addional variables
and pick them up.

Any ideas or sample codes?
From: Kenneth M. Lin on
Use MISSOVER option to automatically set those variables that are not
available to missing.

"Ranjhana" <ranjhanas(a)gmail.com> wrote in message
news:9f6ef461-d577-41a9-aab4-5b9711e9ffa0(a)d3g2000vbr.googlegroups.com...
> Hi,
>
> I want to automate importing a text file whose layout may not be
> standard for every refreh.
> for eg: today i have var1-var10 . tomo i might have var1-var15. my
> code should automatically realise that there are 5 addional variables
> and pick them up.
>
> Any ideas or sample codes?

From: Nathaniel Wooding on
You do not say whether these are character or numeric values nor do you mention whether they are in fixed fields or are separated by some delimiter. The following assumes that you have numeric data.

filename test 'c:\park\test.txt';

/* this file is


1 2 3 4 5
11 22 33 44 55

*/
options symbolgen;

Data _Null_ ;* TAKE A PEAK AT THE FILE AND COUNT THE NUMBER OF FIELDS;
INFILE test;
input @;
numvars = 1 + count( _infile_ , ' ' );

vars = COMPRESS( 'VAR'|| LEFT( put( numvars , BEST. )));
call symput( 'LAST' , VARS );* THIS DEFINES THE LAST VARIABLE TO BE READ;
stop;
run;

Data Readin;
infile test;
input var1 - &last;
run;
proc print;
run;


Nat Wooding


-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Ranjhana
Sent: Monday, February 15, 2010 6:01 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: Import a text file

Hi,

I want to automate importing a text file whose layout may not be
standard for every refreh.
for eg: today i have var1-var10 . tomo i might have var1-var15. my
code should automatically realise that there are 5 addional variables
and pick them up.

Any ideas or sample codes?
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.