From: mahi on
is there any way to directly stack 2 different folders in sas..

question:
i have 3 datasets in folder1 and 1 dataset or no dataset in
folder2

first i need to stack 3 datasets from folder1 and then stack the
result with folder2 and the final result should be in folder2..

i want to do this without hardcoding..
From: Patrick on
You either define one library for each folder - or you could also
create a concatenated library addressing both folders at once.

If it's a concatenated library: Make sure to have folder2 as first
folder in the list of paths as SAS will write it's results to the
first folder in the list.

Stacking: I assume this would be a PROC APPEND or a SQL UNION or just
a Data Step with set TblA TblB ... TblD;
From: Arthur Tabachneck on
Mahi,

I agree with Patrick's suggestion but, since you mentioned that you
didn't want to hardcode the solution, I'll add that you could include
a proc sql call to build the set statement. For example:

libname one "c:\test1";
libname two "c:\test2";

data one.file1;
set sashelp.class;
run;

data one.file2;
set sashelp.class;
run;

data two.file3;
set sashelp.class;
run;

libname both ("c:\test2" "c:\test1");

proc sql noprint;
select 'both.'||memname
into :files
separated by ' '
from dictionary.tables
where libname="BOTH";
quit;

data both.want;
set &files.;
run;

HTH,
Art
--------------
On Jul 29, 3:45 pm, mahi <mehetrey.mahen...(a)gmail.com> wrote:
> is there any way to directly stack  2 different folders in sas..
>
> question:
> i have 3 datasets in folder1   and     1 dataset or no dataset in
> folder2
>
> first i need to stack 3 datasets from folder1 and then stack the
> result with folder2 and the final result should be in folder2..
>
> i want to do this without hardcoding..

On Jul 29, 5:23 pm, Patrick <patrick.mat...(a)gmx.ch> wrote:
> You either define one library for each folder - or you could also
> create a concatenated library addressing both folders at once.
>
> If it's a concatenated library: Make sure to have folder2 as first
> folder in the list of paths as SAS will write it's results to the
> first folder in the list.
>
> Stacking: I assume this would be a PROC APPEND or a SQL UNION or just
> a Data Step with set TblA TblB ... TblD;
From: mahi on
On Jul 29, 6:28 pm, Arthur Tabachneck <art...(a)netscape.net> wrote:
> Mahi,
>
> I agree with Patrick's suggestion but, since you mentioned that you
> didn't want to hardcode the solution, I'll add that you could include
> a proc sql call to build the set statement.  For example:
>
> libname one "c:\test1";
> libname two "c:\test2";
>
> data one.file1;
>   set sashelp.class;
> run;
>
> data one.file2;
>   set sashelp.class;
> run;
>
> data two.file3;
>   set sashelp.class;
> run;
>
> libname both ("c:\test2" "c:\test1");
>
> proc sql noprint;
>     select 'both.'||memname
>       into :files
>         separated by ' '
>           from dictionary.tables
>             where libname="BOTH";
> quit;
>
> data both.want;
>   set &files.;
> run;
>
> HTH,
> Art
> --------------
> On Jul 29, 3:45 pm, mahi <mehetrey.mahen...(a)gmail.com> wrote:
>
> > is there any way to directly stack  2 different folders in sas..
>
> > question:
> > i have 3 datasets in folder1   and     1 dataset or no dataset in
> > folder2
>
> > first i need to stack 3 datasets from folder1 and then stack the
> > result with folder2 and the final result should be in folder2..
>
> > i want to do this without hardcoding..
>
> On Jul 29, 5:23 pm, Patrick <patrick.mat...(a)gmx.ch> wrote:
>
>
>
> > You either define one library for each folder - or you could also
> > create a concatenated library addressing both folders at once.
>
> > If it's a concatenated library: Make sure to have folder2 as first
> > folder in the list of paths as SAS will write it's results to the
> > first folder in the list.
>
> > Stacking: I assume this would be a PROC APPEND or a SQL UNION or just
> > a Data Step with set TblA TblB ... TblD;

i got the result..
thank you..
but i was also trying to do with proc append
BUT PROC APPEND WORKS ONLY WHEN DATASETS HAVE SAME VARIABLE BUT WHAT
IF DATASETS HAVE DIFFERENT VARIABLES?
From: Patrick on
Then you're using "outer union corr" in SQL or "set" in a SAS data
step.