I have a data set with a column that indicates poor sleep, but instead of filling in all of the cells, they only indicated "y" if the patient had poor sleep.
How can I fill in the blank cells so they contain "n"?
I tried making a new column:
DATA polphar.Polypharm_DataV3;
SET polyphar.polypharm_data;
IF poor_sleep= "." then poor_sleepYN= "N";
IF poor_sleep= "y" THEN poor_sleepYN= "Y";
RUN;
But it keeps giving me this error: ERROR: Libref POLPHAR is not assigned.
I am using SAS University Edition.
Actually, you just have a typo, not the y in one and not the other.
DATA polphar.Polypharm_DataV3;
SET polyphar.polypharm_data;
@DK13 wrote:
I have a data set with a column that indicates poor sleep, but instead of filling in all of the cells, they only indicated "y" if the patient had poor sleep.
How can I fill in the blank cells so they contain "n"?
I tried making a new column:
DATA polphar.Polypharm_DataV3;
SET polyphar.polypharm_data;
IF poor_sleep= "." then poor_sleepYN= "N";
IF poor_sleep= "y" THEN poor_sleepYN= "Y";
RUN;
But it keeps giving me this error: ERROR: Libref POLPHAR is not assigned.
I am using SAS University Edition.
Actually, you just have a typo, not the y in one and not the other.
DATA polphar.Polypharm_DataV3;
SET polyphar.polypharm_data;
@DK13 wrote:
I have a data set with a column that indicates poor sleep, but instead of filling in all of the cells, they only indicated "y" if the patient had poor sleep.
How can I fill in the blank cells so they contain "n"?
I tried making a new column:
DATA polphar.Polypharm_DataV3;
SET polyphar.polypharm_data;
IF poor_sleep= "." then poor_sleepYN= "N";
IF poor_sleep= "y" THEN poor_sleepYN= "Y";
RUN;
But it keeps giving me this error: ERROR: Libref POLPHAR is not assigned.
I am using SAS University Edition.
Good catch! Thanks!
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 lock in 2025 pricing—just $495!
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.