Recently in the SAS Community Library: When developing a brand-new SAS Viya job, it sometimes might be hard to figure out where to begin. It’s always a best practice to start with a working SAS program, but when it comes to developing a prompt form for the end user, there are many decisions to make. Should you create an HTML form? What kind of controls should you provide to the user? What parameters do you need to supply? Fortunately, SAS provides a set of sample jobs, including both code and forms, that can make getting started much easier. This post by @GregTreiman discusses how to use the included SAS samples to jump start your own job development.
I got the SAS code below to add multiple texts to the figure created by sgplot. However, it does not work. Could you help me correct it? Many thanks.
/* Main data set */
data mydata;
input x y;
datalines;
1 10
2 20
3 30
;
run;
/* Annotation data set */
data annotations;
input x y text $20.;
datalines;
1 15 "First Note"
2 25 "Second Note"
3 35 "Third Note"
;
run;
/* Plot with annotations */
proc sgplot data=mydata;
scatter x=x y=y; /* Main plot */
text x=x y=y text=text / data=annotations; /* Adding annotations */
run;
... View more
The "Green Blue" color looks red on my monitor, but "Blue Green" looks similar to cyan, as expected.
SAS documentation (from %HELPCLR(CNS);) says: 3. The hues may be combined in either order. Blue Green is the same as Green Blue. A hue with the "ish" suffix must be listed first, as in Yellowish Green.
SAS code to show this (ran in SAS 9.4 TS1M8, Windows 10):
data test;
colorname='Green Blue'; output;
colorname='Blue Green'; output;
run;
proc report data=test;
title1 'What is going on with BLUE GREEN named color combinations?';
column colorname colorname=clr;
define colorname/ 'Color Name';
define clr / 'Color';
compute clr /char length=200;
call define(_col_,'style','style={background='||colorname||'}');
endcomp;
run;
@carpentera
(code adapted from https://blogs.sas.com/content/sgf/2016/08/03/tips-for-working-with-color-names-formats-macros-ods-excel-and-proc-report)
Additional reference here: https://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#colors-specify-color.htm
... View more
I have the following data that lists each person's hospital admission dates during a pre-defined study period. patient_id admit_dt 1 1/3/2012 1 11/21/2017 1 10/2/2018 1 10/3/2018 1 11/12/2018 1 8/21/2019 1 3/13/2021 1 5/2/2021 I want to find if a person has at least 2 hospital admissions within 2 years of each other. So far, I have the following code, but it only compares each admission to the earliest admission date. data data_out;
set data_in;
retain first_admit_dt;
by patient_id;
if first.patient_id then do;
first_admit_dt=admit_dt;
end;
else do;
ddiff=admit_dt-first_admit_dt;
if ddiff<(365*2) then admit_flag=1;
end;
format first_admit_dt mmddyy10.;
drop first_admit_dt;
run; This is the output I'm getting: patient_id admit_dt ddiff admit_flag 1 1/3/2012 . . 1 11/21/2017 2149 . 1 10/2/2018 2464 . 1 10/3/2018 2465 . 1 11/12/2018 2505 . 1 8/21/2019 2787 . 1 3/13/2021 3357 . 1 5/2/2021 3407 . However, I want to see if any of the admission dates are within 2 years of each other, not just compared to the earliest admission date. From the example above, 11/21/2017 is not within 2 years from the first admit date of 1/3/2012. However, the admit date on 10/2/2018 is within 2 years of 11/21/2017, so this person would be considered to have at least 2 admissions within 2 year of each other. Thank you
... View more
I am in the middle of a Coursera sponsored SAS course, and I'm required to upload a file to the Server and Files panel but I cannot find it.
... View more
I have two proc tabulate tables shown in the photo below. I was wondering if there is a way to combine the tables together to look more like the excel table photo also attached? The "Measure", "Definition", the all black column, and the target column are not needed they just are in the excel file. The top table is the "(Hospitalists)" and the bottom table is the "(All Providers)".
... View more
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9. Sign up by Dec. 31 to get the 2024 rate of just $495. Register now!