Help using Base SAS procedures

%scan

Accepted Solution Solved
Reply
Contributor
Posts: 50
Accepted Solution

%scan

Hi All,

%let m=delhi, 1;

data test;

m1=%scan(&var,1,%bquote(,));

proc print;

run;

I want that m1 takes value delhi in the data step. Please suggest.

Regards

SK


Accepted Solutions
Solution
‎10-15-2013 02:26 AM
Frequent Contributor
Posts: 120

Re: %scan

so you want m1 to get the value from the variabel delhi and not the value "delhi"?

Like this?

%let m=delhi, 1;

data test;
delhi = 'Aruba';
m1=%scan(&m,1);

proc print;

run;

View solution in original post


All Replies
Frequent Contributor
Posts: 120

Re: %scan

why not just use scan?

m1=scan(&m",1,',');

Smiley Happy

Contributor
Posts: 50

Re: %scan

Hi Fredrik,

It doesnt work, I could have used that but if you take a look at the macro parameter then it creates a new variable called delhi which is the first occurence in the macro 'm and something that is not desired.

Regards

SK

Solution
‎10-15-2013 02:26 AM
Frequent Contributor
Posts: 120

Re: %scan

so you want m1 to get the value from the variabel delhi and not the value "delhi"?

Like this?

%let m=delhi, 1;

data test;
delhi = 'Aruba';
m1=%scan(&m,1);

proc print;

run;

Contributor
Posts: 50

Re: %scan

perfect!

☑ This topic is SOLVED.

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

Discussion stats
  • 4 replies
  • 211 views
  • 0 likes
  • 2 in conversation