Learning SAS? Welcome to the exclusive online community for all SAS learners.

suggestions

Reply
Occasional Contributor
Posts: 10

suggestions

Hi All!

I am wondering some body could help me on sas/af tool and SCL code.

I created a macrode variable in SCL by proc sql into:  but I am wondering how to initialize the macrovariable with a blank value or how to reset to blank.

The macro variable which I was created always picking previous value and giving me hard time.

Plz suggest how to reset or initialize the macro variable to blank to avoid picking previous values while running SAS/AF tool.

Thanks,

saskris

Super User
Posts: 11,343

Re: suggestions

Probably a better place to ask this than SAS Analytics U for Learning as that doesn't include SAS/AF.

The best place is likely in an init: block depending on timing though removing it after use.

It may help to show HOW you are using the macro variable as what you are doing with it may be retaining the value regardless of the value of the macro variable.

Occasional Contributor
Posts: 10

Re: suggestions

Hi Ballardw,

The following code I used to create macro variable:

submit continue;

proc sql;

select distinct  ........ into:macrovariable

separated by ' ' from work.file

where observation = ' ' or count = 0 or .;

quit;

endsubmit;

macrovariable = symget('macrovariable')

if observation = macrovariable then do;

put.............................;

link errpp;

end;

plz suggest me where can I ask (which community) these questions.

Super User
Posts: 3,261

Re: suggestions

Would this do what you want?

submit continue;

%let macrovariable =;

proc sql;

select distinct  ........ into:macrovariable

separated by ' ' from work.file

where observation = ' ' or count = 0 or .;

quit;

endsubmit;

macrovariable = symget('macrovariable')

if observation = macrovariable then do;

put.............................;

link errpp;

end;

Occasional Contributor
Posts: 10

Re: suggestions

Hi SASKiwi,

Its absolutely working fine and picking missing observations and linked to errpp at first time.  When the work.file changes by selecting other listing item then its not liked to errpp though the work.file observation has missing value or count.

I wondering that its may be due to storing the macrovariable value?

Let me know how to initialize or reset or delete macro variable value to blank or delete.

Super User
Posts: 11,343

Re: suggestions

Unless you are using the SCL variable macrovaraible some where else it looks like:

immediately after

macrovariable = symget('macrovariable');

call symput('macrovariable',_blank_);

after link errpp;

you could try

macrovariable= _blank_;

I would search my code for everywhere macrovariable is used to see if you are also putting that value into something else that maintains the value of the original macrovariable t

Occasional Contributor
Posts: 10

Re: suggestions

I am using SCL code and I was getting error: cannot pass missing value argument to function SYMPUT.

Super User
Posts: 3,261

Re: suggestions

It would help if you provided the rest of the code including the SYMPUT.

Ask a Question
Discussion stats
  • 7 replies
  • 377 views
  • 0 likes
  • 3 in conversation