Recently in the SAS Community Library: SAS' @Sundaresh1 highlights a sometimes overlooked task when applying document embeddings for purposes of similarity-based search. Normalisation of vectors helps obtain relevant matches.
Hi all,
Please help me to code this. This is the dataset below-
I have 2 drugs being used for each ID i.e., SGA and DM. I have multiple start date and end dates for each ID and drug. I want to see if the DM_start falls into any of the SGA_start and SGA_end under each id. That is DM_start of period 3 can fall in the SGA_start and SGA_end of period1.
And also calculate the number of overlapping days for each time period. I want to know the no. of days for each orange period.
Thank you all in advance,
Any help would be appreciated.
... View more
I'm having difficulty writing a piece of SAS code and I'm seeking the most effective approach within SAS. I have a variable named 'type' (with values 1, 2, 3, 4) and client IDs. Essentially, I aim to create another variable called 'modified_type,' which follows these rules: If there's a single unique client ID with only 1 in the 'type' variable, then 'modified_type' should be set to 0. However, if there are multiple client IDs with the same number having 1 in the 'type' variable, 'modified_type' should be set to 1. If there are 2 in the 'type' variable, then 'modified_type' should be set to 2... and so on. I tried using the retain function so something like this: retain modified_type 0; if first.client_id then modified_type = 0; if type = '1' or type = '1st' then modified_type = 1; else if type = '2' or = '2nd' then modified_type = 2; and so on..... but these does seem to retain 0 in the type and for some reason shows as 1. Yea im note sure the best way to do this, a newbie at SAS so would even appreciate the point in the right direction:
... View more
As I recently posted here, I'm trying to create Table 1 for a research journal article. @Reeza pointed me to the Table 1 macro "TableN" and it looks like exactly what I need.
I downloaded the macro and ran it, and then I tried to call it based on the example provided.
/*Example macro call*/
/*%tablen(data=example, by=arm,
var=age date_on sex race1 smoke_st num_met,
type=1 3 2, outdoc=~/ibm/example1.rtf);*/
/*My version*/
%tablen(data=have, by=TM_group,
var=DEM_AGE DEM_SEX,
type=2 2, outdoc="C:\data_output\test.rtf);
But I got an error after "by TM_group": ERROR: All positional parameters must precede keyword parameters. I looked up the error and it has something to do with the commas between the parameters. After some trial and error of deleting commas, I got it to run without error, but it doesn't produce any output.
Sample data is provided below:
data have;
infile datalines dsd dlm=',' truncover;
input DEM_AGE DEM_SEX cohort_flag TM_group;
datalines;
3,1,1,0
2,1,1,1
3,2,1,1
3,2,1,1
3,2,1,0
2,2,1,1
2,1,1,1
3,1,1,1
2,1,1,1
3,2,1,0
2,1,1,0
2,2,1,1
3,2,1,0
2,2,0,
3,2,1,1
3,2,1,1
3,1,1,0
3,2,1,0
2,1,1,0
3,1,1,1
3,2,1,1
3,2,1,0
3,2,1,1
3,2,1,1
3,2,1,1
; RUN;
proc format library=temp;
value age2grp
1='1:Age Group <65'
2='2:Age Group [65,75)'
3='3:Age Group >=75'
.='Inapplicable/Missing';
value sex
.='Inapplicable/Missing'
1='1:Male'
2='2:Female'
value yesfmt
1='1:Yes'
2='2:No'
.='Inapplicable/Missing'
;
RUN;
... View more
Hi everyone, I can see all the markers in the plot, but the corresponding admission dates on the x-axis are not fully visible. How can I adjust to see every admission date? proc shewhart data=VV; xchart LOS*admission_date /Markers outtable=outtable nohlabel TOTPANELS=1; run;proc print;run; Thanks,
... View more
Hi everyone,
I am writing to seek assistance with centering the values of "HR (95% CI)" in a PROC SGPLOT procedure.
Currently, in my code, the values of "HR (95% CI)" (Var name=HR2)are aligned to the left, and I would like to center them instead. However, I am unsure how to achieve this.
Below is my SAS code:
proc sgplot data=forest_subgroup_2 nowall noborder nocycleattrs dattrmap=attrmap noautolegend;
format text $txt.;
styleattrs axisextent=data;
refline ref2 / lineattrs=(thickness=13 color=cxf0f0f7);
highlow y=obsid low=CIL high=CIU;
scatter y=obsid x=hr / markerattrs=(symbol=squarefilled);
scatter y=obsid x=hr / markerattrs=(size=0) x2axis;
refline 1 / axis=x;
text x=xl y=obsid text=text / position=bottom contributeoffsets=none strip;
yaxistable subgroup / location=inside position=left textgroup=id labelattrs=(size=7)
textgroupid=text indentweight=indentWt;
yaxistable HR2 pvalue/ location=inside position=right pad=(right=15px)
labelattrs=(size=7) valueattrs=(size=7) ;
yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.0;
xaxis display=(nolabel) /* TYPE=LOG TYPE=LOG LOGSTYLE=LOGEXPAND LOGBASE=10 */ values=(0.0 0.5 1.0 1.5 2.0 2.5 3.0 );
x2axis label='Hazard Ratio' display=(noline noticks novalues) labelattrs=(size=8);
run;
Could you please advise me on how I can modify the yaxistable HR2 code to center align the values of "HR (95% CI)"?
Thank you very much for your attention to this matter. I look forward to your guidance.
... View more