Prev: Aqualogic BPM Experienced Consultants- NJ - 12+ Months contract
Next: Google team, can you delete rubbish message posted on comp.soft-sys.sas
From: mahi on 29 Jul 2010 15:45 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 29 Jul 2010 17:23 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 29 Jul 2010 18:28 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 30 Jul 2010 15:40 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 30 Jul 2010 21:20
Then you're using "outer union corr" in SQL or "set" in a SAS data step. |