Hi,
I am a beginner. Want to know the informat for a range of values.
e.g in the input variable column, I have numbers, then few ranges:
1
2
43
781
226-250
770-821
...
900-921.
When I do data cleaning, the last ranges get converted into '.'.
There is no range informat; SAS is built to hold one data item per variable.
data want; infile datalines dlm="-" missover; input min max; datalines; 1 2 43 781 226-250 770-821 ; run;
You can then access the individual data items by variable name, so range is variable min, and variable max.
You may need to desribe a bit more of what you are actually doing or want to do with this variable.
If the data is coming to you as shown are you attempting to check membership in a range: is this value in the range of 900-921? Or is the data recorded as "900-921" and you want to assign a specific value? Is the variable supposed to be numeric (something you would do arithmetic with or calculate means and such) or a category indicator (where text is perfectly fine)?
If the value is supposed to be numeric you would have to decide on a single value to represent the range. A custom informat could be used to read the data and assign that value, or you could recode the raw value into another variable with the desired value.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.