SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Informat for a range of values

Reply
Contributor
Posts: 24

Informat for a range of values

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 '.'.

 

 

 

Super User
Super User
Posts: 7,401

Re: Informat for a range of values

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.

Super User
Posts: 10,500

Re: Informat for a range of values

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.

 

 

Ask a Question
Discussion stats
  • 2 replies
  • 237 views
  • 0 likes
  • 3 in conversation