From: hallbird on
Guys,
lets say the path have numric folder, and I want the variable date
numric,
'20091229'

"
%macro doimport(Filename);
proc import
out=&Filename.
datafile="C:\EDM Landing Area\Input Folder\&Filename.\Customer.csv"
/*datafile="C:\Users\hallbird\Load\A\&Filename.\Cusotmer.csv" */
dbms=csv
replace;
getnames=YES;
DATAROW=2;
run;
%mend;
"
%doimport(20091229)

but each time i try it show error and dosen't allow ,
plus there're dates folder,from date folder the the doimport should
take
I hope you can give hand in this..
From: "Choate, Paul on
Hallbird -

The "out=&Filename." will resolve to "out=20091229" - SAS dataset names need to begin with a letter or an underscore, and so this will generate an error.

Try something like "out=File&Filename." - this will resolve to "out=File20091229" which is a valid SAS dataset name.

http://support.sas.com/onlinedoc/913/getDoc/en/lrcon.hlp/a000998953.htm

If your date/names like 20091229 are stored in a SAS dataset then you can read them a number of ways, such as using CALL EXECUTE or SQL INTO, or similar. You will need to be more specific for more detail.

If you include a working example (i.e. a source data step with input datalines/cards) you will get better responses.

hope that helps

Paul Choate
DDS Data Extraction
(916) 654-2160

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of hallbird
Sent: Monday, December 28, 2009 1:22 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: Re: Dynamic path reader,

Guys,
lets say the path have numric folder, and I want the variable date
numric,
'20091229'

"
%macro doimport(Filename);
proc import
out=&Filename.
datafile="C:\EDM Landing Area\Input Folder\&Filename.\Customer.csv"
/*datafile="C:\Users\hallbird\Load\A\&Filename.\Cusotmer.csv" */
dbms=csv
replace;
getnames=YES;
DATAROW=2;
run;
%mend;
"
%doimport(20091229)

but each time i try it show error and dosen't allow ,
plus there're dates folder,from date folder the the doimport should
take
I hope you can give hand in this..
From: Arthur Tabachneck on
Hallbird,

A SAS filename can't start with a number but, rather, has to start with
either an underscore or letter.

If that's ok with you, then you could do what you want by simply adding a
couple of lines of code. E.g.:

%macro doimport(Filename);
proc import
%if %sysfunc(anydigit(&Filename.,1)) eq 1 %then %do;
out=_&Filename.
%end;
%else %do;
out=&Filename.
%end;
datafile="C:\EDM Landing Area\Input Folder\&Filename.\Customer.csv"
/*datafile="C:\Users\hallbird\Load\A\&Filename.\Cusotmer.csv" */
dbms=csv
replace;
getnames=YES;
DATAROW=2;
run;
%mend;

%doimport(20091229)

HTH,
Art
--------
On Mon, 28 Dec 2009 13:22:27 -0800, hallbird <hallbird2(a)GMAIL.COM> wrote:

>Guys,
>lets say the path have numric folder, and I want the variable date
>numric,
>'20091229'
>
>"
>%macro doimport(Filename);
> proc import
> out=&Filename.
> datafile="C:\EDM Landing Area\Input Folder\&Filename.\Customer.csv"
> /*datafile="C:\Users\hallbird\Load\A\&Filename.\Cusotmer.csv" */
> dbms=csv
> replace;
> getnames=YES;
> DATAROW=2;
> run;
>%mend;
>"
>%doimport(20091229)
>
>but each time i try it show error and dosen't allow ,
>plus there're dates folder,from date folder the the doimport should
>take
>I hope you can give hand in this..
From: hallbird on
Hi,
sorry for being late, thanks guys for sharing,
"Choate, Paul(a)DDS", thanks for sharing.

thanks so much Arthur Tabachneck for solution,
and i want to execute form dataset. but am not sucess in this show me
error

" data abbas;
set Match_date;
call execute(%doimport(a));
run; "
a= 20091228
it's add the a in path not 20091228

ERROR: Physical file does not exist, C:\EDM Landing Area\Input Folder\a
\Customer.csv


From: hallbird on
Guys,
I've solve it,
I'll put the code maybe someone will required

"
data abbas;
set Match_date;
call symput ("Filename", a);
call execute('%doimportt(&Filename)');
run;
"
one thing, after the flat loaded, how can I make column CustomerID
primary key dynamically or thorugh the csv is there way ?
thanks