Help using Base SAS procedures

%scan

Accepted Solution Solved
Reply
Contributor
Posts: 57
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
Regular Contributor
Posts: 191

Re: %scan

Posted in reply to Siddharth123

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
Regular Contributor
Posts: 191

Re: %scan

Posted in reply to Siddharth123

why not just use scan?

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

Smiley Happy

Contributor
Posts: 57

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
Regular Contributor
Posts: 191

Re: %scan

Posted in reply to Siddharth123

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: 57

Re: %scan

perfect!

🔒 This topic is solved and locked.

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

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