04-28-2016 10:50 AM
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:
When I do data cleaning, the last ranges get converted into '.'.
04-28-2016 11:05 AM
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.
04-28-2016 11:27 AM
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.