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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.