|
|||
|
Rather new to sas and am trying to use a %let statement.
I want to make use a % let statement for 0806, so I only have to change that number once in my code. You see it 4 times used below. I don't have a macro setup in this code. /*join call*/ proc sql; create table spd.acq_data_0806_2 as (select a.*, b.* from spd.acq_data_0806 as a quit; /*flag state, and add var*/ data spd.acq_data_0806_3; set spd.acq_data_0806_2; What all do I need to include in order use a %let statment similar to %let day=0806. |
|
|
||||
|
||||
|
|
|
|||
|
On Tuesday, August 7, 2012 8:55:11 AM UTC-5, (unknown) wrote:
> Rather new to sas and am trying to use a %let statement. > > > > I want to make use a % let statement for 0806, so I only have to change that number once in my code. You see it 4 times used below. I don't have a macro setup in this code. > > > > > > /*join call*/ > > proc sql; > > create table spd.acq_data_0806_2 as > > (select a.*, b.* > > from spd.acq_data_0806 as a > > quit; > > > > /*flag state, and add var*/ > > data spd.acq_data_0806_3; > > set spd.acq_data_0806_2; > > > > What all do I need to include in order use a %let statment similar to %let day=0806. asssign a macro variable day to the 0806 and use &day in the rest of the code. also, check the syntax of your sql code %let day = 0806; proc sql; create table spd.acq_data_&day_2 as (select a.*, b.* from spd.acq_data_&day as a quit; /*flag state, and add var*/ data spd.acq_data_&day_3; set spd.acq_data_&day_2; run; HTH Al |
|
|||
|
On Tuesday, August 7, 2012 8:55:11 AM UTC-5, (unknown) wrote:
> Rather new to sas and am trying to use a %let statement. > > > > I want to make use a % let statement for 0806, so I only have to change that number once in my code. You see it 4 times used below. I don't have a macro setup in this code. > > > > > > /*join call*/ > > proc sql; > > create table spd.acq_data_0806_2 as > > (select a.*, b.* > > from spd.acq_data_0806 as a > > quit; > > > > /*flag state, and add var*/ > > data spd.acq_data_0806_3; > > set spd.acq_data_0806_2; > > > > What all do I need to include in order use a %let statment similar to %let day=0806. %let day = 0806; > proc sql; > > create table spd.acq_data_&day_2 as > > (select a.*, b.* > > from spd.acq_data_&day as a > > quit; > > > > /*flag state, and add var*/ > > data spd.acq_data_&day_3; > > set spd.acq_data_&day_2; run; also , check you sql code for syntax errors HTH Al |
|
|||
|
On Tuesday, August 7, 2012 10:42:44 AM UTC-4, Al wrote:
> On Tuesday, August 7, 2012 8:55:11 AM UTC-5, (unknown) wrote: > Rather new to sas and am trying to use a %let statement. > > > > I want to make use a % let statement for 0806, so I only have to change that number once in mycode. You see it 4 times used below. I don't have a macro setup in this code. > > > > > > /*join call*/ > > proc sql; > > create table spd.acq_data_0806_2 as > > (select a.*, b.* > > from spd.acq_data_0806 as a > > quit; > >> > /*flag state, and add var*/ > > data spd.acq_data_0806_3; > > set spd.acq_data_0806_2; > > > > What all do I need to include in order use a %let statment similar to %let day=0806. asssign a macro variable day to the 0806 and use &day in the rest of the code. also, check the syntax of your sqlcode %let day = 0806; proc sql; create table spd.acq_data_&day_2 as (select a.*, b.* from spd.acq_data_&day as a quit; /*flag state, and add var*/ data spd.acq_data_&day_3; set spd.acq_data_&day_2; run; HTH Al So %macro macro1(day); and then put a %mend at the end of my code. is that what you are referring too? |
|
|||
|
On Tue, 7 Aug 2012 07:42:44 -0700 (PDT), Al <ali6058@gmail.com> wrote:
>On Tuesday, August 7, 2012 8:55:11 AM UTC-5, (unknown) wrote: >> Rather new to sas and am trying to use a %let statement. >> >> >> >> I want to make use a % let statement for 0806, so I only have to change that number once in my code. You see it 4 times used below. I don't have a macro setup in this code. >> >> >> >> >> >> /*join call*/ >> >> proc sql; >> >> create table spd.acq_data_0806_2 as >> >> (select a.*, b.* >> >> from spd.acq_data_0806 as a >> >> quit; >> >> >> >> /*flag state, and add var*/ >> >> data spd.acq_data_0806_3; >> >> set spd.acq_data_0806_2; >> >> >> >> What all do I need to include in order use a %let statment similar to %let day=0806. > >asssign a macro variable day to the 0806 and use &day in the rest of the code. also, check the syntax of your sql code > >%let day = 0806; >proc sql; > create table spd.acq_data_&day_2 as Doesn't that need to be &day._2? > (select a.*, b.* > >from spd.acq_data_&day as a > > quit; > > > > /*flag state, and add var*/ >data spd.acq_data_&day_3; >set spd.acq_data_&day_2; Also for the two above. >run; -- Remove del for email |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|