- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 04-21-2010 10:12 PM
(1377 views)
The data set I have has countless of records. The records are dated under variable FILMDATE. And FILMDATEs are categorized by cycles. I want to categorize the FILMDATEs. Here is my data below:
Cycle 1 if visited the clinic between 1969 and 1973
Cycle 2 if visited the clinic between 1971 and 1976
Cycle 3 if visited the clinic between 1975 and 1980
Cycle 4 if visited the clinic between 1978 and 1982
Cycle 5 if visited the clinic between 1981 and 1985
If the year in FILMDATE does not match the range defined for each cycle, then I want to keep the value of the cycle but create a new date variable where the incorrect value of FILMDATE is replaced by the year at midpoint of the range for each cycle (like 1971 for cycle 1).
How do I do this using PROC SQL?
Cycle 1 if visited the clinic between 1969 and 1973
Cycle 2 if visited the clinic between 1971 and 1976
Cycle 3 if visited the clinic between 1975 and 1980
Cycle 4 if visited the clinic between 1978 and 1982
Cycle 5 if visited the clinic between 1981 and 1985
If the year in FILMDATE does not match the range defined for each cycle, then I want to keep the value of the cycle but create a new date variable where the incorrect value of FILMDATE is replaced by the year at midpoint of the range for each cycle (like 1971 for cycle 1).
How do I do this using PROC SQL?
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I need to clarify. The data is above. Let's say I have the year 1972. That could be either cycle 1 or cycle 2. If I have the year 1979, that could be cycle 3 or 4. How do I do that in PROC SQL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"If I have the year 1979, that could be cycle 3 or 4. How do I do that in PROC SQL? "
So what should it be then? What's the logic to decide whether it's cycle 3 or 4?
Without knowing that one can't even start coding.
Does it have to be in SQL (and why) or would a SAS datastep do as well?
You will get the best answers by providing sample data (SAS data step creating this data) and then give an example of how the desired output should look like. Message was edited by: Patrick
So what should it be then? What's the logic to decide whether it's cycle 3 or 4?
Without knowing that one can't even start coding.
Does it have to be in SQL (and why) or would a SAS datastep do as well?
You will get the best answers by providing sample data (SAS data step creating this data) and then give an example of how the desired output should look like. Message was edited by: Patrick