Hello all, I am very new to SAS. I can interpret a few things in SAS but when it comes to writing a code I am completely lost. data dormant_pca_cc; set dev.fcs_jun19_dorm_pca_cc_build; Above is my dataset info. Attached is the file containing the final variables(along with variable description) which should be considered for calculating obligator level score/ PD. The dependent variable is: FCS_bad_9m_Jun19 Can anyone help me writing a code to calculate obligator level PD in SAS? Many thanks, A
... View more
Greetings. I asked an online LLM to generate some SAS code for me. It did so. I haven't tried the code yet. The procedures contained in the code are listed below. I'm wondering if any of the procedures will be missing from SAS online, SAS Studio? Please explain limitations that exist, such as which procedures are missing, dataset size limits, code length limits, etc.
SAS Procedures Required In LLM-Generated Code: proc assoc proc cluster proc corr proc cvmodelfit proc fcmp proc glm proc glmselect proc hpensemble proc hpforest proc hplogistic proc hpreduce proc import proc means proc nlin proc optmodel proc print proc score proc sgplot proc sql proc stdize proc surveyselect proc transpose proc tree
... View more
data _null_; string = 'antioxidant'; length unique $200 position_list $200; do i = 1 to length(string); letter = substr(string, i, 1); count = countc(string, letter); if count = 1 then do; unique = cats(unique, letter); position_list = cats(position_list, i); end; end; put unique; put position_list; run;
I want output position of non repeated letters like below
Non-Repeated_Letters
O
X
D
antioxidant
5
6
8
... View more
I'm kind of confused about what a library is. I think it's just a folder that contains folders and files, but this is not clear to me. If a library doesn't have any files (but rather has files in subfolders), will files not be accessible? Would we/can therefore add another libref to a subfolder to access those files within subfolders?
... View more
Hi SAS Coders:
I am trying to change numeric observations into character so I can do my analysis, but it is showing blank observations for these variables:
Obs
fast
purge
language
age_group
sex_category
ethnicity
USBorn
slimfast
DescribeWt
HomeEnv
1
.
.
E
<11
Male
NonH
Life
No
VeryOver
PrettyT
2
.
.
E
<11
Male
NonH
Life
No
SlghtOve
VeryTru
3
.
.
E
<11
Male
Hisp
Miss
Mis
Right
Missing
4
.
.
E
<11
Female
NonH
Life
No
Right
VeryTru
5
.
.
E
<11
Male
Hisp
Life
No
SltUnder
PrettyT
6
.
.
E
<11
Female
Hisp
Life
No
Right
VeryTru
7
.
.
E
<11
Female
NonH
Life
No
Right
PrettyT
8
.
.
E
<11
Female
NonH
Life
No
SlghtOve
PrettyT
9
.
.
E
<11
Female
NonH
Life
No
SltUnder
VeryTru
10
.
.
E
<11
Female
NonH
Life
No
Right
VeryTru
I know the observations are in fact numeric as it says "1" and "2" in the dataset
My code is this:
DATA WORK.CLEANDATA;
SET YRRSIMPT.import;
/* Categorize age */
IF age < 11 THEN age_group = "<11";
ELSE IF age = 12 THEN age_group = "12";
ELSE IF age = 13 THEN age_group = "13";
ELSE IF age = 14 THEN age_group = "14";
ELSE IF age >= 15 THEN age_group = "14+";
ELSE age_group = "Missing";
/* Categorize sex */
IF sex = 1 THEN sex_category = "Female";
ELSE IF sex = 2 THEN sex_category = "Male";
ELSE sex_category = "Missing";
IF v4 = 1 THEN ethnicity = "Hisp";
ELSE IF v4 = 2 THEN ethnicity = "NonHisp";
ELSE ethnicity = "Missing";
/* Categorize v66 (USBorn) */
IF v66 = 1 THEN USBorn = "<1Yr";
ELSE IF v66 = 2 THEN USBorn = "1-3Yrs";
ELSE IF v66 = 3 THEN USBorn = "4-6Yrs";
ELSE IF v66 = 4 THEN USBorn = "6+Yr";
ELSE IF v66 = 5 THEN USBorn = "Life";
ELSE USBorn = "Missing";
/* Categorize v51 */
IF v51 = 1 THEN fast = "Yes";
ELSE IF v51 = 2 THEN fast = "No";
ELSE fast = "Missing";
/* Categorize v52 */
IF v52 = 1 THEN purge = "Yes";
ELSE IF v52 = 2 THEN purge = "No";
ELSE purge = "Missing";
/* Categorize v53 */
IF v53 = 1 THEN slimfast = "Yes";
ELSE IF v53 = 2 THEN slimfast = "No";
ELSE slimfast = "Missing";
IF v49 = 1 THEN DescribeWt = "VUnderWt";
ELSE IF v49 = 2 THEN DescribeWt = "SltUnder";
ELSE IF v49 = 3 THEN DescribeWt = "Right";
ELSE IF v49 = 4 THEN DescribeWt = "SlghtOver";
ELSE IF v49 = 5 THEN DescribeWt = "VeryOver";
ELSE DescribeWt = "Missing";
/* Categorize v71 (HomeEnv) */
IF v71 = 1 THEN HomeEnv = "NotTrue";
ELSE IF v71 = 2 THEN HomeEnv = "LilTrue";
ELSE IF v71 = 3 THEN HomeEnv = "PrettyTrue";
ELSE IF v71 = 4 THEN HomeEnv = "VeryTrue";
ELSE HomeEnv = "Missing";
KEEP age_group ethnicity sex_category HomeEnv purge fast USBorn DescribeWt language slimfast;
RUN;
... View more