Prev: Problem when using the SAS/GRAPH Procedures: SGPLOT and SGPANEL
Next: Notes produced from proc mixed
From: Ian Whitlock on 20 Jan 2010 12:04 Summary: Concatenate vs PROC APPEND #iw-value=1 Wendy, You may want: > rsubmit; > proc sql ; > Select table_names into : tbl_nm separated by ' ' > from all_table_names; > quit; > data base_table ; set &tbl_nm ; > run; > > endrsubmit; PROC APPEND uses variables from first data set and drops any variables not conforming to that first pattern; hence it is doubtful that this is what you want. The SET statement will add new variables. In either case watch out for a variable where the type changes but the name stays the same, or the type and name stay the same but the meaning changes. Ian Whitlock =============== Date: Tue, 19 Jan 2010 15:17:35 -0800 From: pigpigpig <pigzhu740(a)GMAIL.COM> Subject: Re: proc append to combine multiple tables on Unix Content-Type: text/plain; charset=ISO-8859-1 On Jan 19, 6:16 pm, pigpigpig <pigzhu...(a)gmail.com> wrote: > Hi, > > Thanks for any tips: > > I have over 400 daily tbls on Unix.. Majority of these tables have > identical fields and types (char/num) > Just a few of them have slightly different fields due to changes in > production.. but i am not sure what dates it started from. > > I built a marco to store all the daily tables' names.. and try to use > proc append.. FORCE option to append them.. ( SET in data step doesn't > work because of the dicrepancy among the tables, that is why I think > the FORCE option in proc append may help). I thought i was smart.. > unfortunately, I got stuck.. > Seems proc append can only combine two tables at a time. > > rsubmit; > proc sql ; > Select table_names into : tbl_nm separated by ' ' > from all_table_names; > quit; > > proc append data=base_table data=&tbl_nm force; > run; > > endrsubmit; > > Wendy Note that my tables are all on unix.. not local
From: pigpigpig on 21 Jan 2010 10:04 Thank you all for the time and effort to help me out.. I think i am almost there, but still.. . Here are the revised codes based on your suggestion: %macro appendn ; rsubmit; proc sql; select count(table_names) into: cnt from all_table_names; select table_names into :var1 - :var%TRIM(%LEFT(&cnt)) from all_table_names; quit; %do i=1 %to &cnt; table=var&i proc append base=base_table data=&&table force; run; %end; endrsubmit; %mend; %appendn; But it gave me such error... I don't see anything wrong in my codes.. any further thinkings from you guys? NOTE: Remote submit to _SERVER_ commencing. WARNING: Apparent symbolic reference CNT not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &cnt ERROR: The %TO value of the %DO I loop is invalid. ERROR: The macro APPENDN will stop executing. 38 proc sql; 39 select count(filename) into: cnt from filename1; 40 select filename into :var1 - :var%TRIM(%LEFT(&cnt)) from filename1; 41 quit; NOTE: The PROCEDURE SQL printed pages 16-19. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
From: shiva on 21 Jan 2010 11:06 Hi Wendy, Sorry for untested code. Try this ...hope this helps.. %macro test; proc sql; select count(table_names) into :cnt from all_table_names; select table_names into :var1 - :var%TRIM(%LEFT(&cnt)) from all_table_names; quit; %do i=1 %to &cnt; %let table=&&var&i; proc append base=base_table data=&&table force; run; %end; %mend test; %test; Thanks; shiva
From: pigpigpig on 21 Jan 2010 13:22 On Jan 21, 11:06 am, shiva <shiva.said...(a)gmail.com> wrote: > Hi Wendy, > > Sorry for untested code. > > Try this ...hope this helps.. > > %macro test; > proc sql; > select count(table_names) into :cnt from all_table_names; > select table_names into :var1 - :var%TRIM(%LEFT(&cnt)) from > all_table_names; > quit; > %do i=1 %to &cnt; > %let table=&&var&i; > proc append base=base_table data=&&table force; > run; > %end; > %mend test; > %test; > > Thanks; > shiva Similar error again. I think it may have something to do with the macro CNT WARNING: Apparent symbolic reference CNT not resolved. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &cnt ERROR: The %TO value of the %DO I loop is invalid. ERROR: The macro APPENDN will stop executing.
From: shiva on 22 Jan 2010 01:20 Hi, I think there is empty space in macro variable cnt. Try to store that and resolve it. %macro test; %let cnt1=&&cnt; %do i=1 %to &cnt1; %let table=&&var&i; proc append base=base_table data=&&table force; run; %end; %mend test; %test; Thanks, shiva
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: Problem when using the SAS/GRAPH Procedures: SGPLOT and SGPANEL Next: Notes produced from proc mixed |