BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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?
2 REPLIES 2
deleted_user
Not applicable
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?
Patrick
Opal | Level 21
"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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1207 views
  • 0 likes
  • 2 in conversation