Keep track of who accessed SAS data sets in a compute server
Recent Library Articles
Recently in the SAS Community Library: SAS' @BrunoMueller gets asked whether it is possible to track who has accessed which SAS data sets and when. He usually refers them to this article: Auditing data access: who did what and when? This post expands on that article and explains how to use this in SAS Viya with additional features such as custom message layout and filtering (no log entries for libref WORK or SASHELP).
Is it possible to use the text input control to filter a table using mutliple values? My example is an item code, and I want users to be able to search for multiple item codes with the results displayed together in the report. Currently, if I run this with one text input code, it filters down the table, but if i try multiple (spaced with space, comma or semi-colon) it doesn't work.
... View more
I tried to do data want; infile 'data set'; input totsps totspm totspt totspw; avgsp = (totsps +totspm +totspt+totspw/4); run; but it creates a new variable but not a new output for avgsp. please help... i feel like my input step may be wrong
... View more
Howdy!
I am trying to use the PRESORTED option of PROC SORT to avoid multiple, very lengthy (~10 minutes) sorts. However, I am finding that SAS sometimes does not accept that a sorted dataset is truly sorted when also using NoDupRec.
My dataset, labs, I have already sorted by all variables. When I sort it with no options, SAS tells me it's already sorted. When I add PRESORTED, it tells me it's already sorted. But when I add PRESORTED and NoDupRec, it tells me the data is not sorted. However, the meta data does show the data sorted (of course). Does anyone know what's going on?
1125 proc sort data = labs;
1126 by _all_;
1127 run;
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1456.12k
OS Memory 26644.00k
Timestamp 03/26/2025 10:21:41 PM
Step Count 50 Switch Count 0
1128 proc sort data = labs presorted;
1129 by _all_;
1130 run;
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
memory 1456.12k
OS Memory 26644.00k
Timestamp 03/26/2025 10:21:41 PM
Step Count 51 Switch Count 0
1131 proc sort data = labs presorted noDupRec;
1132 by _all_;
1133 run;
NOTE: Input data set is not in sorted order.
When I tried a super simple example, it works fine.
1143 proc sort data = sasHelp.class out = class;
1144 by _all_;
1145 run;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: SAS sort was used.
NOTE: The data set WORK.CLASS has 19 observations and 5 variables.
NOTE: Compressing data set WORK.CLASS increased size by 100.00 percent.
Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
memory 1213.43k
OS Memory 26636.00k
Timestamp 03/26/2025 10:23:46 PM
Step Count 56 Switch Count 0
1146 proc sort data = class presorted;
1147 by _all_;
1148 run;
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 328.28k
OS Memory 25860.00k
Timestamp 03/26/2025 10:23:46 PM
Step Count 57 Switch Count 0
1149 proc sort data = class presorted noDupRec;
1150 by _all_;
1151 run;
NOTE: Sort order of input data set has been verified.
NOTE: There were 19 observations read from the data set WORK.CLASS.
NOTE: Input data set is already sorted, no sorting done.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 328.28k
OS Memory 25860.00k
Timestamp 03/26/2025 10:23:46 PM
Step Count 58 Switch Count 0
Thanks,
Michael
... View more
Hi, I have attached herewith dataset and coding script in sas on demand. I am having diificult in running the below code, would appreciate if anybody can help me out;- Tried with different ways as following but not working stilll: *Step 4: Random Forest (More Robust Alternative)) */ PROC FOREST DATA=credit_data_transformed; TARGET Default_Flag / LEVEL=BINARY; INPUT Log_Income Log_Loan_Amount Interest_Loan_Term Interest_Rate Debt_to_Income_Ratio Delinquency_History Credit_Score_High Credit_Score_Medium Age_Young Age_Middle / LEVEL=INTERVAL; NTREES=100; /* Number of trees */ SEED=12345; OOBPREDICT; OUTPUT OUT=rf_preds PREDICTED=RF_Pred_Prob; RUN; PROC HPFOREST DATA=credit_data_transformed OUTMODEL=rf_model; TARGET Default_Flag / LEVEL=BINARY; /* Specify the binary target */ INPUT Log_Income Log_Loan_Amount Interest_Loan_Term Interest_Rate Debt_to_Income_Ratio Delinquency_History Credit_Score_High Credit_Score_Medium Age_Young Age_Middle / LEVEL=INTERVAL; /* Specify input variables */ /* Specify number of trees and random seed */ NTREES=100; SEED=12345; /* Optional: for scoring output */ SCORE OUT=rf_preds; RUN; PROC HPFOREST DATA=credit_data_transformed OUTMODEL=rf_model; TARGET Default_Flag / LEVEL=BINARY; /* Specify the binary target */ INPUT Log_Income Log_Loan_Amount Interest_Loan_Term Interest_Rate Debt_to_Income_Ratio Delinquency_History Credit_Score_High Credit_Score_Medium Age_Young Age_Middle / LEVEL=INTERVAL; /* Specify input variables */ /* Number of trees, random seed, and model training */ NTREES=100; /* Specify the number of trees */ SEED=12345; /* Set the random seed */ TRAINFRAC=0.7; /* Use 70% of the data for training */ /* Store the predictions */ SCORE OUT=rf_preds; RUN; PROC SETINIT; RUN;
... View more
I'm a beginner to SAS. I'm trying to have nested counts presented cleanly as follows. This is code to generate toy data, as well as 3 attempts I tried (from hours of googling how to do this) that give the correct info, but none are as clean as the above. Imagine how awful they'd look when I need more than 2 layers of nesting. and multiplying together the total number of categories per variables is large, but the actual number of their combinations in the data is small. data toy;
input A $ B $;
datalines;
A1 B1
A1 B2
A1 B2
A2 B1
A2 B1
A2 B1
A2 B2
A2 B2
A2 B2
A2 B2
;
proc tabulate data=toy;
class A B;
table A*(B all) all;
run;
proc summary data=toy print;
class A B;
run;
proc freq data=toy;
tables A*B / nopercent norow nocol;
run;
... View more
Nominations are in, and the SAS Customer Recognition Awards voting is complete! Winners get a full trip to SAS Innovate (May 6-9) in Orlando, FL! See the 60+ inspiring entries from SAS users! Winners will be announced at SAS Innovate!