DATA Step, Macro, Functions and more

What's wrong with the variable input in a macro

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 99
Accepted Solution

What's wrong with the variable input in a macro

%macro makeVarMap(dsact);

proc transpose data=&dsform out=tempform  (keep =_name_);

var c1--no;

run;

%mend;

%macro makeVarMap(thesis.sb_v_12);

doesn't work while following codes works

proc transpose data=thesis.sb_v_12 out=tempform  (keep =_name_);

var c1--no;

run;

thesis.sb_v_12 has several variables like c1,c2,c3,n1,n2,n3 and end with no.

and the error codes seems point to the irregular format of dataset name :thesis.sb_v_12,but this kind of naming method works with my

other macros.

Can anyone give a thought?

Thanks.


Accepted Solutions
Solution
‎06-06-2012 05:02 AM
Super User
Posts: 9,682

Re: What's wrong with the variable input in a macro

I noticed a problem.

%macro makeVarMap(dsact);

proc transpose data=&dsform out=tempform  (keep =_name_);

var c1--no;

run;

%mend;

They are diferent.

Ksharp

View solution in original post


All Replies
Solution
‎06-06-2012 05:02 AM
Super User
Posts: 9,682

Re: What's wrong with the variable input in a macro

I noticed a problem.

%macro makeVarMap(dsact);

proc transpose data=&dsform out=tempform  (keep =_name_);

var c1--no;

run;

%mend;

They are diferent.

Ksharp

Frequent Contributor
Posts: 99

Re: What's wrong with the variable input in a macro

Ksharp,

     Thank u very much.I made a silly mistake.

PROC Star
Posts: 1,563

Re: What's wrong with the variable input in a macro

Please give credit by clicking "correct answer", it is the least you can do to acknowledge the time and effort people spend helping you.

Frequent Contributor
Posts: 99

Re: What's wrong with the variable input in a macro

snapshot.JPG

Chris,

I know I should acknowledge those who have given help.

I put on a snapshot here to show that there's no correct answer button here.

the 3 clicks below translating into english is "diversity,like, reply"

PROC Star
Posts: 1,563

Re: What's wrong with the variable input in a macro

Good on you for trying.

That's odd, you should also have a yellow star and a green one if you are logged in.

"Diversity" is "Branch" in the english version.


Frequent Contributor
Posts: 99

Re: What's wrong with the variable input in a macro

Chris,

Thanks for your reminding.I'm so appreciated with other's patient help and always bearing in mind to click on those "correct answer" if have.

I am logging on, maybe it's due to my location?

It happend some times.

And now the correct answer appears.

Confused.

Dawn.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 240 views
  • 3 likes
  • 3 in conversation