Decimal places in a macro string

Accepted Solution Solved
Reply
Occasional Learner
Posts: 1
Accepted Solution

Decimal places in a macro string

[ Edited ]

Hello,

 

Wondering if someone could help me with the following macro, specifically the first %LET statement with the decimal in:


%LET YDAY = %STR ( 365.25 );

%DO Y = 1 %TO 12;
PROC LIFETEST ..... TIMELIST = %QSCAN ( &YDAY, &Y ) 

 

The macro runs perfectly when I remove the decimals in the %LET statement, but when I keep the decimal in, it reads the decimal as a "space" instead of a full decimal - eg. it reads it as 325 then 25.

 

Wondering if anyone knows how to resolve this please?

 

Thanks in advance.

 

Kate


Accepted Solutions
Solution
‎12-15-2016 06:18 AM
Super User
Posts: 5,518

Re: Decimal places in a macro string

Posted in reply to kingarfield

Evidently %SCAN / %QSCAN treat a dot as a delimiter.  You can overcome that by specifying your own list of delimiters which includes only a blank.  The syntax:

 

%QSCAN ( &YDAY, &Y , %STR( ))

View solution in original post


All Replies
Solution
‎12-15-2016 06:18 AM
Super User
Posts: 5,518

Re: Decimal places in a macro string

Posted in reply to kingarfield

Evidently %SCAN / %QSCAN treat a dot as a delimiter.  You can overcome that by specifying your own list of delimiters which includes only a blank.  The syntax:

 

%QSCAN ( &YDAY, &Y , %STR( ))

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 191 views
  • 1 like
  • 2 in conversation