Recently in the SAS Community Library: Transposing data is useful when your data structure conflicts with your analysis needs. For example, transposing time series data can make trend analysis and forecasting easier, and customer transactional data is often transposed to enhance customer segmentation and targeting processes. In this article, SAS' @SASJedidiscusses the “tools of the trade” for SAS programmers. Specifically: PROC TRANSPOSE and DATA step with arrays and DO Loops.
I'm working in SAS Visual Analytics version 4.0. I would like to partition data in Build Models, but the corresponding menu in project settings is grayed out (see screenshot below). Additionally, I would like to partition data in a specific way using my blocking variable "block". Based on the options shown above, there does not appear to be a way to do this. However, it does seem that the "Explore and Visualize" module has this capability, however, my blocking variable is not listed as an option for some reason (see screenshot below). Available are a number of categorical variables, and for some reason a single continuous variable. Note that the variable "Block" is visible in the data pane as a categorical variable with 4 levels. Ideally, my data partitions would set training, validation, and test partitions to 50, 25, and 25%, respectively, using any of blocks 1, 2, 3, of 4. Thanks for reading!
... View more
Hi everyone, I need to write a code that can generate gini coeff. for every variable and create an example table like this; example: Predictor Gini Coef CC_RSK_AMT 0,7 CC_APP_CNT_L12M 0,6 OD_APP_CNT_L12M 0,4 CNSMR_APP_CNT_L12M 0,266666667 MRTG_APP_CNT_L12M 0,116666667 BANKA_SAY 0,6 TOPLAM_RISK_MEMZUC 0,6 TOPLAM_RISK_MEMZUC_2 0,6 LIMIT_ALL 0,6 LIMIT_2 0,6 LIMIT_ORAN 0,6 RISK_ORAN 0,6 and my code is ; data your_data; set WORK.GINI_COEFF_DENEME; run; %let predictors = CC_RSK_AMT CC_APP_CNT_L12M OD_APP_CNT_L12M CNSMR_APP_CNT_L12M MRTG_APP_CNT_L12M BANKA_SAY TOPLAM_RISK_MEMZUC TOPLAM_RISK_MEMZUC_2 LIMIT_ALL LIMIT_2 LIMIT_ORAN RISK_ORAN; * Initialize the Gini coefficient table with necessary columns; data gini_table; length Predictor $50. Gini_Coef 8.; keep Predictor Gini_Coef; run; %macro calculate_gini; %let i = 1; %let predictor = %scan(&predictors, &i); %do %while(&predictor ne ); * Run logistic regression for the current predictor; proc logistic data=your_data; model FIY_HAS_F(event='1') = &predictor; roc 'ROC' &predictor; ods output ROCInfo=roc_info; run; * Check if the model converged; data _null_; set roc_info; if _N_ = 1 then call symputx('model_converged', '1'); else call symputx('model_converged', '0'); run; %if &model_converged = 0 %then %do; %put WARNING: Model did not converge for predictor &predictor; %let i = %eval(&i + 1); %let predictor = %scan(&predictors, &i); %continue; %end; * Extract the AUC from the ROCInfo table and calculate Gini coefficient; data auc_data(keep=Predictor Gini_Coef); set roc_info; if ROCModel = 'ROC' and ROCType = 'C'; auc = C; Gini_Coef = 2 * auc - 1; Predictor = "&predictor"; output; run; * Append the Gini coefficient of the current predictor to the Gini table; proc append base=gini_table data=auc_data force; run; * Move to the next predictor; %let i = %eval(&i + 1); %let predictor = %scan(&predictors, &i); %end; %mend calculate_gini; * Run the macro to calculate Gini coefficients for all predictors; %calculate_gini; * View the Gini coefficient table; proc print data=gini_table; var Predictor Gini_Coef; run; But it keeps giving this warning and then error: WARNING: Output 'ROCInfo' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used ERROR: File WORK.ROC_INFO.DATA does not exist. Can any one please please help me?
... View more
Hi Co's,
I wanted to know why smtp configuration is required in sas, I mean I know it is required to send a email , user can use, monitor jobs etc.
I have few questions with smtp setup in sas.
1. Is it default with sas ? I mean during installation and configuration , mostly we do setup smtp.
2. What will happen if we dont want smtp setup - will it only impact users and they will not be able to send email by sas program ? or anything it is really required to have it ? I am sure we(as sas admin) will get not any trigger for our environment down, or any short of notification as per environment availability.
Why I am checking, only concern for us, with smtp we can send email outside organisation as well, which our security team is not liking it(part of auditing). Do we have any options to restrict the email? it should go within organization, not outside ...
Your suggestion, please.
Thanks.
... View more
I have a table XYZ and I am running below code to get frequency of two fields in that table. proc freq data = XYZ; tables Pre_intent*T4 / nopercent norow nocol; run; I get below output. Table of Pre_intent by T4 Pre_intent T4 1 ER 2 UC 3 OV Total 1 ER 9 1 176 376 2 UC 26 12 1450 4333 3 OV 7 2 539 1576 Total 42 15 2165 6285 I would like to add a 'percentage of total' field so it would look like below. Table of Pre_intent by T4 Pre_intent T4 1 ER 2 UC 3 OV Total Percentage of Total 1 ER 9 1 176 376 0.05982498 2 UC 26 12 1450 4333 0.689419252 3 OV 7 2 539 1576 0.250755768 Total 42 15 2165 6285 1 Also, how do I save this frequency table as a dataset??? Thanks in advance for all your help!
... View more
I am using the SAS OnDemand for Academics (free online version), I have attached a portion of my code. The only error code I am getting is that there is missing or invalid data but I'm not sure where that would be coming from. It will also give a NOTE: Invalid data for DAP in line 144 1-18. which repeats for YEAR in line 145 1-18, PLOT in line 146 1-17, REP in line 147 1-17, TRT in line 148 1-17, NDVI in line 149 1-17 and this pattern repeats through the code. Any advice would be welcome! data alldata;
input DAP YEAR PLOT REP TRT NDVI;
datalines;
114 1 402 4 3 0
114 1 403 4 2 0
114 1 404 4 1 0
125 2 401 4 2 0.855
125 2 402 4 3 0.825
125 2 403 4 4 0.815
119 3 303 3 3 0.69
119 3 304 3 2 0.775
119 3 403 4 4 0.705
;
run;
proc sort data=alldata; BY Year DAP;
proc glimmix data = alldata; BY Year DAP;
class REP TRT;
model NDVI = TRT;
random REP;
lsmeans TRT / lines;
run;
... 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!