BookmarkSubscribeRSS Feed
Malk020
Fluorite | Level 6

Please, anyone, help me with the question!
I spent days but I could not do it!
Thank you

 

  1. create another dataset that schedules subjects for their next three visits, once every 30 days starting at the baseline visit date, for a total of four visits per subjects. Each of the visits should appear as a new observation with the original subject information, the median grouping, the corresponding visit date, and a visit number (0, 1, 2, or 3).

 


What I did was created variables with visit1, visit2 and visit 3. I do not think it's correct at all because she wants 30 days between each visit.

 

 

* MEDIAN;
PROC MEANS DATA = INFO MEAN MEDIAN Q3 Q1;
VAR B_Cholesterol; RUN;
PROC UNIVARIATE DATA = INFO;
VAR B_Cholesterol; RUN;
proc sql;
create table want as
select Median(B_Cholesterol) as med
from info;
quit;
*to create a variable that groups subjects as less than or equal to
the median, or more than the median;
PROC SQL;
create table want as
select B_Cholesterol as median
from info
where B_Cholesterol >= 220;
quit;
*Creating visit number for longitudinal data;
DATA vis;
set info;
Visit1=1;
Visit2=2;
Visit3=3;
RUN; PROC PRINT DATA = vis; run;

 

 

2 REPLIES 2
tarheel13
Rhodochrosite | Level 12

no, that does not look correct. can you post your sample data? you might want to look up intnx function.

PaigeMiller
Diamond | Level 26

 

  1. create another dataset that schedules subjects for their next three visits, once every 30 days starting at the baseline visit date, for a total of four visits per subjects. Each of the visits should appear as a new observation with the original subject information, the median grouping, the corresponding visit date, and a visit number (0, 1, 2, or 3).

 

Something like this:

 

data want;
    set have;
    do visit_number=0 to 3;
        visit_date=baseline_date+30*visit_number;
        output;
    end;
    format visit_date date9.;
run;
    

 

 

I don't know what "median grouping" means, so I didn't address that part of the problem.

 

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 832 views
  • 0 likes
  • 3 in conversation