Hi, tsmk is my time-dependent covariate, deathstatus_inhance is censor, and stime_inhance is time. The "Change step" worked well, but the "Count step" only worked for four observations and stopped. Please help me to correct my code. DATA analysis.change;
SET analysis.smk_stime2;
ARRAY tsmk_(*) tsmk_1-tsmk_5; *call in the time-varying smoking variables;
ARRAY chng(5); *the new indicator variables;
t=1; *initialize the position variable for the indicator variables;
DO i = 2 TO 5;
IF tsmk_(i) NE tsmk_(i-1) THEN DO; *detects whether there is a change in smoking status;
chng(t) = i-1; *assigns the last year the status remained constant;
t=t+1;
END;
END;
RUN;
DATA analysis.count;
SET analysis.change;
ARRAY tsmk_(*) tsmk_1-tsmk_5; /* call in the time-varying smoking variables */
ARRAY chng(*) chng1-chng5; /* call in the indicator variables */
start = 0; /* initialize the beginning time for the study */
censor2 = 0; /* initialize the new censor variable */
t = 1; /* initialize the position variable for the indicator variables (chng1-chng5) */
DO i=1 TO stime_inhance; /* makes sure we only output the records that smoking status remains constant */
IF (chng(t) > . and chng(t) < stime_inhance) or i = stime_inhance THEN do;
/* assign the value of smoking status */
IF chng(t) > . THEN smoking_status = tsmk_(chng(t));
ELSE smoking_status = tsmk_(stime_inhance); /* assign the end time */
stop = min(chng(t), stime_inhance); /* assign the value of the censor variable */
IF i = stime_inhance THEN censor2 = deathstatus_inhance; /* assign the new start time */
IF t > 1 THEN start = chng(t-1); /* move the position variable */
t = t + 1;
OUTPUT; /* output the record to the new dataset */
end;
END;
RUN;
... View more
Hi guys,
suppose to have the following:
data DB;
input Code_1 :$20. Code_2 :$20. Code_3 :$20. Explanation_1 :$20. Explanation_2 :$20. Explanation_3 :$20.;
cards;
89.7 0 89.65 General_Visit 0 Monitor
0 89.61 0 0 Check 0
89.7 89.65 0 General_Visit Pressure 0
0 0 0 0 ECG 0
0 0 91.49.2 0 0 0
.....
;
Is there a way to get the frequency of each Code* with associated Explanation* for the entire data set? The frequency should be reported also if there is only the Code or only the Explanation. Overall the dataset has Codes from *_1 to *_82 and Explanation from *_1 to *_82.
Desired output:
data DB1;
input Code :$20. Explanation :$20. Freq :$20.;
cards;
Code Explanation Freq
89.7 General_Visit 2
89.65 Monitor 1
89.65 Pressure 1
89.61 Check 1
. ECG 1
91.49.2 . 1
run;
Thank you in advance
... View more
I write one macro which works fine to split data into 2-subgroups.
Logic is 1) sort by target var 2) based on weight/wt, split into 2 subgroups.
BUT how to split into N-Subgroups with N as a parameter, say N=3 or 7?!
%macro bisect(ds, byvar, cutvar, note);
proc sort data=&ds.; by &byvar.; run;quit;
data &ds.;
set &ds.;
retain wt_sum;
wt_sum=coalesce(wt_sum,0)+&cutvar.;
run;quit;
data &ds.(drop=wt_sum);
set &ds.;
if wt_sum<=50 then ¬e.=1;
else ¬e.=0;
run;quit;
%mend;
... View more
Hello, I don't have much experience with SAS VA. The user is requesting the creation of a custom page where they can select various options as shown in the attached photo. I need to be able to capture the selected parameters in a job execution. The page in the attached image is a test created using HTML code in SAS job execution. Could you please guide me on how to capture the parameters in a new job upon clicking the button? Thank you.
... View more
Hi I am currently building a dashboard on viya for learners as part of my masters program and for one part I need to display values on a bar chart but I also would like to add a line on each bar that is the cut-off value but I can't find a object that allows me to do it in such a way. Is there any way I can do this ? This is how my Bar chart looks I have values for each year for the size but I still need to display the cut-off value on this bar chart in a line or something for each year can this be done in VA?
... View more