Date: Tue, 31 Aug 2004 12:46:01 -0400
Reply-To: Bob_Abelson@HGSI.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bob Abelson <Bob_Abelson@HGSI.COM>
Subject: Re: Creating dataset
Content-Type: text/plain; charset="us-ascii"
An,
A couple of things stand out.
First, do you want N to be part of your input statement? Seems like you
need a condition in your second step:
if type="$" then TEMP=TRIM(LEFT(VNAME)) ||""||TRIM(LEFT(TYPE)) || "" ||
LEN;
else TEMP=TRIM(LEFT(VNAME)) ||""|| LEN;
The error message about no cards or infile is for your last data step,
which has neither a CARDS nor an INFILE statement. Where is the data
supposed to come from? You need an INFILE there, because you can't use
CARDS (or DATALINES) inside a macro.
I hope this helps.
Bob Abelson
HGSI
240 314 4400 x1374
bob_abelson@hgsi.com
An Am <aarumugam@STTHOMAS.EDU>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
08/31/2004 12:00 PM
Please respond to An Am
To: SAS-L@LISTSERV.UGA.EDU
cc:
Subject: Creating dataset
I am trying to create a dataset using the data below.
%MACRO PROCESS;
DATA VAR_LIST;
INFILE LOC DLM ='09'x;
INPUT VNAME $ TYPE $ LEN $;
;
DATA datset;
SET VAR_LIST;
TEMP=TRIM(LEFT(VNAME)) ||""||TRIM(LEFT(TYPE)) || "" || LEN;
RUN;
PROC SQL noprint;
SELECT TEMP INTO :COLS SEPARATED BY ' ' FROM DATSET;
QUIT;
%let punc=;;
DATA AE;
INPUT &COLS &punc;
;
%put &cols;
proc contents data=ae;
%MEND PROCESS;
%PROCESS;
I have data like this.
VNAME TYPE LEN
PROTO $ 20
SITEID $ 10
PID N 8
SEX N 8
SIL N 4
I am getting an output like this
Variable Type Len Pos
-----------------------------------
N Num 8 8
PID Num 8 0
PROTO Char 1 24
SEX Num 8 16
SITEID Char 1 25
SIL Num 8 xx
I am wondering why length is going to default like 8 and 1 instead of
retaining 20 and 10 (both numeric and character).
Also an error message occurs saying
"135:ERROR: No CARDS or INFILE statement.
138:WARNING: The data set WORK.AE may be incomplete. When this step was
stopped there were 0 observations and 5 variables.
Help please.
Thanks,
AN