Hello programmers,
I don't know if this title is really what I want to implement, but I will explain. And I'll be glad to get more insight.
I am working on the BRFSS Dataset, and I want to get the number of times per day or week a patient uses a medication.
For example, observations with 301-399 for the variable ILP08_3 recorded their number of times in days, while observations with 401-499 recorded their number of times in weeks.
So if an observation recorded 306, "3" already lets us know we are dealing with a record in days, while "06" indicates the number of times. So, this case used their medication 6 times in a day.
Same way if an observation was recorded as 402. It means that this case used their medication 2 times a week.
What I want to do: I want to be able to split the response into 2. For example, if a response is "306' for a case with the variable ILP08_3, I want to split it into 2 variables with "3" and "06" (numeric) on different columns.
I appreciate suggestions or referrals.
Let's use simple math. First variable: divide by 100 and then find the integer lower than this result (the FLOOR function). Then the second variable is simply the remainder.
Example:
data example;
code=306;
first_variable=floor(code/100);
second_variable=code - first_variable*100;
run;
Let's use simple math. First variable: divide by 100 and then find the integer lower than this result (the FLOOR function). Then the second variable is simply the remainder.
Example:
data example;
code=306;
first_variable=floor(code/100);
second_variable=code - first_variable*100;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.