Hello community,
I am trying to start a countreg with wmat, this is the code:
%let model_features =
pls_:
;
%let zeromodel_features =
pls_:
;
%let spatial_effects =
pls_:
;
%let dispmodel_features =
pls_:
;
%let sel_ic=AIC;
proc sql noprint;
select index_n into :rows_test separated by ',' from test001;
quit;
proc sql noprint;
select count(*) into :total_rows
from test001;
quit;
/* Step 2: Dividere le righe in due macro variabili */
%let half_rows = %sysevalf(&total_rows./2, ceil); /* Calcola la metà arrotondata per eccesso */
proc sql noprint;
/* Prima metà */
select index into :columns_test1 separated by ' '
from test001(obs=&half_rows);
/* Seconda metà */
select index into :columns_test2 separated by ' '
from test001(firstobs=%eval(&half_rows.+1));
quit;
data w_train;
set w;
if index_n not in (&rows_test);
drop index_n
/* Usare per prendere tutti gli id , dividiamo per ovviare al numero di caratteri nella macro*/
&columns_test1. &columns_test2.;
run;
proc countreg data=train001 wmat=w_train nonormalize method=qn
outest=regout;
%if &sysver ne V.04.00 %then
%do;
performance nthreads=80;
%end;
model tgt_n_interferenze=&model_features. / dist= poisson
SELECTVAR=INFO(direction=BACKWARD criter=&sel_ic.);
/* dispmodel tgt_n_interferenze ~ &dispmodel_features. / SELECTVAR=INFO( direction = BACKWARD criter = &sel_ic.); */
/* zeromodel tgt_n_interferenze ~ &zeromodel_features. / */
/* SELECTVAR=INFO(direction=BACKWARD criter=&sel_ic.); */
spatialeffects &spatial_effects. / SELECTVAR=INFO(direction=BACKWARD
criter=&sel_ic.);
spatialid index;
store poisson_001;
output out=outmodel_001 xbeta=xbeta pred=pred variance=variance
probzero=probzero probcount(0 to 7) zgamma=zgamma
/* gdelta=gdelta mode=intmu mu=mu nu=nu lambda=lambda */;
run;
When I start the same code with a train table of 15k rows the countreg works properly, but with a table with 25k doesn't start.
This is the log:
1 /* region: Generated preamble */
2 /* Make sure the current directory is writable */
3 data _null_;
4 length rc 4;
5 %let tworkloc="%sysfunc(getoption(work))";
6 rc=dlgcdir(&tworkloc);
7 run;
NOTE: The current working directory is now
"/data/saswork/SAS_workADC400000190_sas-compute-server-e6efb690-130a-4d50-bf8e-930bee2ff814-mst2l".
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 475.34k
OS Memory 58012.00k
Timestamp 01/21/2025 11:54:33 AM
Step Count 132 Switch Count 0
Page Faults 0
Page Reclaims 12
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
8
9 /* Setup options */
10 title;
11 footnote;
12 options validvarname=any;
13 options validmemname=extend;
14 options dtreset date number;
15 options device=png;
16
17 /* Setup macro variables */
18 %let syscc=0;
19 %let _clientapp = %nrquote(%nrstr(SAS Studio));
20 %let _clientappabbrev = %nrquote(%nrstr(Studio));
21 %let _clientappversion=2024.03;
22 %let _clientversion=;
23 %let _sasservername=&SYSHOSTNAME;
24 %let _sashostname=&SYSHOSTNAME;
25 %let _sasprogramfilehost=&SYSHOSTNAME;
26 %let _clientuserid = %nrquote(%nrstr(snm0mxf));
27 %let _clientusername = %nrquote(%nrstr(Monica Fontana));
28 %let clientmachine = %nrquote(%nrstr());
29 %let _clientmachine = %nrquote(%nrstr());
30 %let _clientmode = %nrquote(%nrstr(viya));
31 %let sasworklocation="%sysfunc(getoption(work))/";
32 filename _cwd &sasworklocation;
33 data _null_;
34 call symput('_sasworkingdir',pathname('_cwd'));
35 run;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 476.28k
OS Memory 58012.00k
Timestamp 01/21/2025 11:54:33 AM
Step Count 133 Switch Count 0
Page Faults 0
Page Reclaims 11
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
36 filename _cwd;
NOTE: Fileref _CWD has been deassigned.
37 %let _sasprogramfile = %nrquote(%nrstr());
38 %let _baseurl = %nrquote(%nrstr(https://snamprodmp.ondemand.sas.com/SASStudio/));
39 %let _execenv = %nrquote(%nrstr(SASStudio));
40 %symdel _dataout_mime_type _dataout_name _dataout_url _dataout_table / nowarn;
41 %let _sasws_ = %bquote(%sysfunc(getoption(work)));
42 %let _saswstemp_ = %bquote(%sysfunc(getoption(work)));
43
44 /* Detect SAS/Graph and setup graph options */
45 data _null_;
46 length rc $255;
47 call symput("graphinit","");
48 call symput("graphterm","");
49 rc=tslvl('sasxgopt','n');
50 _error_=0;
51 if (rc^=' ') then do;
52 call symput("graphinit","goptions reset=all gsfname=_gsfname;");
53 call symput("graphterm","goptions noaccessible;");
54 end;
55 run;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 477.34k
OS Memory 58012.00k
Timestamp 01/21/2025 11:54:33 AM
Step Count 134 Switch Count 0
Page Faults 0
Page Reclaims 11
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
56 data _null_;
57 length rc 4;
58 rc=sysprod("PRODNUM002");
59 if (rc^=1) then do;
60 call symput("graphinit","");
61 call symput("graphterm","");
62 end;
63 run;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 490.59k
OS Memory 58012.00k
Timestamp 01/21/2025 11:54:33 AM
Step Count 135 Switch Count 0
Page Faults 0
Page Reclaims 11
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
64
65 /* Setup ODS destinations */
66 ods _all_ close;
67 %studio_results_directory;
MLOGIC(STUDIO_RESULTS_DIRECTORY): Beginning execution.
MLOGIC(STUDIO_RESULTS_DIRECTORY): %GLOBAL _RESULTS_PREFIX_
MLOGIC(STUDIO_RESULTS_DIRECTORY): %LET (variable name is _RESULTS_PREFIX_)
MLOGIC(STUDIO_RESULTS_DIRECTORY): Ending execution.
68 filename _htmlout "&_results_prefix_..html";
69 filename _listout "&_results_prefix_..lst";
70 filename _gsfname temp;
71 filename _dataout "&_results_prefix_..dat";
72 ods autonavigate off;
73 ods graphics on;
74 ods html5 (id=web) METATEXT='http-equiv="Content-Security-Policy" content="default-src ''none''; style-src ''unsafe-inline'';
74 ! img-src data: ;"' device=png gpath="&_saswstemp_" path="&_saswstemp_" encoding=utf8 file=_htmlout (title='Results:SAS
74 ! Program.sas') style=Illuminate options(bitmap_mode='inline' outline='on' svg_mode='inline'
74 ! css_prefix=".ods_&SYS_COMPUTE_JOB_ID" body_id="div_&SYS_COMPUTE_JOB_ID" );
NOTE: Writing HTML5(WEB) Body file: _HTMLOUT
75 ods listing file=_listout;
76 &graphinit;
77 %studio_initialize_custom_output;
MLOGIC(STUDIO_INITIALIZE_CUSTOM_OUTPUT): Beginning execution.
MLOGIC(STUDIO_INITIALIZE_CUSTOM_OUTPUT): %GLOBAL _DATAOUT_NAME _DATAOUT_MIME_TYPE
MLOGIC(STUDIO_INITIALIZE_CUSTOM_OUTPUT): %LET (variable name is _DATAOUT_NAME)
MLOGIC(STUDIO_INITIALIZE_CUSTOM_OUTPUT): %LET (variable name is _DATAOUT_MIME_TYPE)
MLOGIC(STUDIO_INITIALIZE_CUSTOM_OUTPUT): Ending execution.
78 /* endregion */
79
80 %let model_features =
81 pls_:
82 ;
83 %let zeromodel_features =
84 pls_:
85 ;
86 %let spatial_effects=
87 pls_:
88 ;
89 %let dispmodel_features=
90 pls_:
91 ;
92
93 %let sel_ic=AIC;
94
95
96
96 ! proc sql noprint;
97 select index_n into :rows_test separated by ',' from test001;
98 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.04 seconds
user cpu time 0.04 seconds
system cpu time 0.00 seconds
memory 5833.18k
OS Memory 63652.00k
Timestamp 01/21/2025 11:54:33 AM
Step Count 136 Switch Count 1
Page Faults 0
Page Reclaims 82
Page Swaps 0
Voluntary Context Switches 18
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
99
100
101
101 ! proc sql noprint;
102 select count(*) into :total_rows
103 from test001;
104 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 5828.71k
OS Memory 63652.00k
Timestamp 01/21/2025 11:54:33 AM
Step Count 137 Switch Count 0
Page Faults 0
Page Reclaims 18
Page Swaps 0
Voluntary Context Switches 1
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
105
106 /* Step 2: Dividere le righe in due macro variabili */
107 %let half_rows = %sysevalf(&total_rows./2, ceil); /* Calcola la metà arrotondata per eccesso */
108
109
110
110 ! proc sql noprint;
111 /* Prima metà */
112 select index into :columns_test1 separated by ' '
113 from test001(obs=&half_rows);
114
115 /* Seconda metà */
116 select index into :columns_test2 separated by ' '
117 from test001(firstobs=%eval(&half_rows.+1));
118 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.01 seconds
memory 5891.09k
OS Memory 63652.00k
Timestamp 01/21/2025 11:54:34 AM
Step Count 138 Switch Count 0
Page Faults 0
Page Reclaims 46
Page Swaps 0
Voluntary Context Switches 2
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
119
120
121
121 ! data w_train;
122 set w;
123
124 if index_n not in (&rows_test);
125 drop index_n
126
127 /* Usare per prendere tutti gli id , dividiamo per ovviare al numero di caratteri nella macro*/
128 &columns_test1. &columns_test2.;
129 run;
NOTE: There were 37368 observations read from the data set WORK.W.
NOTE: The data set WORK.W_TRAIN has 26158 observations and 26159 variables.
NOTE: Compressing data set WORK.W_TRAIN decreased size by 99.71 percent.
Compressed is 77 pages; un-compressed would require 26173 pages.
NOTE: DATA statement used (Total process time):
real time 15.75 seconds
user cpu time 15.74 seconds
system cpu time 0.04 seconds
memory 60591.00k
OS Memory 118796.00k
Timestamp 01/21/2025 11:54:49 AM
Step Count 139 Switch Count 0
Page Faults 0
Page Reclaims 17285
Page Swaps 0
Voluntary Context Switches 145
Involuntary Context Switches 59
Block Input Operations 0
Block Output Operations 33904
130
131
132
133
133 ! proc countreg data=train001 wmat=w_train nonormalize method=qn
134 outest=regout;
135 %if &sysver ne V.04.00 %then
136 %do;
137 performance nthreads=80;
138 %end;
139 model tgt_n_interferenze=&model_features. / dist= poisson
140 SELECTVAR=INFO(direction=BACKWARD criter=&sel_ic.);
141
142 /* dispmodel tgt_n_interferenze ~ &dispmodel_features. / SELECTVAR=INFO( direction = BACKWARD criter = &sel_ic.); */
143 /* zeromodel tgt_n_interferenze ~ &zeromodel_features. / */
144 /* SELECTVAR=INFO(direction=BACKWARD criter=&sel_ic.); */
145 spatialeffects &spatial_effects. / SELECTVAR=INFO(direction=BACKWARD
146 criter=&sel_ic.);
147 spatialid index;
148 store poisson_001;
149 output out=outmodel_001 xbeta=xbeta pred=pred variance=variance
150 probzero=probzero probcount(0 to 7) zgamma=zgamma
151
152 /* gdelta=gdelta mode=intmu mu=mu nu=nu lambda=lambda */;
153 run;
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.REGOUT may be incomplete. When this step was stopped there were 0 observations and 14 variables.
WARNING: Data set WORK.REGOUT was not replaced because this step was stopped.
WARNING: The data set WORK.OUTMODEL_001 may be incomplete. When this step was stopped there were 0 observations and 108 variables.
WARNING: Data set WORK.OUTMODEL_001 was not replaced because this step was stopped.
NOTE: PROCEDURE COUNTREG used (Total process time):
real time 0.06 seconds
user cpu time 0.05 seconds
system cpu time 0.02 seconds
memory 14791.25k
OS Memory 70968.00k
Timestamp 01/21/2025 11:54:49 AM
Step Count 140 Switch Count 0
Page Faults 0
Page Reclaims 2587
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 408
154
155 /* region: Generated postamble */
156 /* Close ODS destinations */
157 &graphterm; ;*';*";*/;run;quit;
158 quit;run;
159 ods html5 (id=web) close;
160 ods listing close;
161 %if %sysfunc(fileref(_gsfname)) lt 0 %then %do;
162 filename _gsfname clear;
NOTE: Fileref _GSFNAME has been deassigned.
163 %end;
164 %studio_capture_custom_output;
MLOGIC(STUDIO_CAPTURE_CUSTOM_OUTPUT): Beginning execution.
MLOGIC(STUDIO_CAPTURE_CUSTOM_OUTPUT): %IF condition "&_dataout_name" ne "" and "&_dataout_mime_type" ne "" is FALSE
MLOGIC(STUDIO_CAPTURE_CUSTOM_OUTPUT): Ending execution.
165 /* endregion */
166
I would like to upload the tables but they are like 50mb. If you need any other information I will reply you.
Thank you in advance
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.