data s ;
name='a@b@c' ;
new=scan(name,2,'@') ;
run;
i run above program in 9.2 sas version it gives default length 200
but if i run same program in 9.4 sas version it gives same length like name length is 5 and new variable length is also 5.
can you explain that difference?
The documentation is available online for free and i am 100% sure it explains the change.
From my point of view: sas fixed a bad design decision with 9.4
Maxim 1: Read the Documentation.
From the documentation of the SCAN() function:
In a DATA step, if the SCAN function returns a value to a variable that has not yet been given a length, that variable is given the length of the first argument. This behavior is different from the behavior in previous releases of SAS. In previous releases, code that created a variable with a length of 200 might have produced a variable with a length that was greater than expected. If you need the SCAN function to assign a variable with a value that is different from the length of the first argument, use a LENGTH statement.
This documentation is found by:
Go to documentation.sas.com
Open "SAS 9.4 and SAS Viya 3.4 Programming Documentation"
In the navigation pane to the left, select:
Data Step Programming
Functions and CALL Routines
Dictionary of Functions and CALL Routines
scroll down to the SCAN function and select it
All other documentation pertinent to SAS programming is found in the same way, just follow the proper navigation paths.
@thanikondharish wrote:
data s ;
name='a@b@c' ;
new=scan(name,2,'@') ;
run;
i run above program in 9.2 sas version it gives default length 200
but if i run same program in 9.4 sas version it gives same length like name length is 5 and new variable length is also 5.
can you explain that difference?
And when I open the online help for SAS as installed the first section is labeled: What's new and provides links to http://support.sas.com/documentation/whatsnew/
with a bunch of by version topics.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.