Programming the statistical procedures from SAS

Categorizing dates by cycles

Reply
N/A
Posts: 0

Categorizing dates by cycles

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?
N/A
Posts: 0

Re: Categorizing dates by cycles

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?
Respected Advisor
Posts: 3,767

Re: Categorizing dates by cycles

"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
Ask a Question
Discussion stats
  • 2 replies
  • 68 views
  • 0 likes
  • 2 in conversation