BookmarkSubscribeRSS Feed
Lucasmarques94
Calcite | Level 5

Tenho o seguinte código que no caso seria para selecionar uma amostra de 1 atendimento para cada operador e que essa amostra seja 55% baixa complexidade e 35% media complexidade e 10% alta complexidade:

 

/* Etapa 1: Classificar os dados pelo operador e pela complexidade */
proc sort data=QUERY_FOR_MULTISKILLS;
by operador complexidade;
run;

/* Etapa 2: Calcular o tamanho da amostra para cada operador e complexidade */
proc freq data=QUERY_FOR_MULTISKILLS noprint;
tables operador*complexidade / out=amostra_tamanho nofreq nopercent norow;
run;

/* Etapa 3: Calcular a porcentagem para cada operador e complexidade */
data amostra_porcentagem;
set amostra_tamanho;
total_obs + count;
run;

/* Etapa 4: Amostragem estratificada para atingir a distribuição desejada */
data amostra_final;
set QUERY_FOR_MULTISKILLS;
if complexidade = 'Baixa complexidade'n then
weight = count / total_obs * 0.55;
else if complexidade = 'Média complexidade'n then
weight = count / total_obs * 0.35;
else if complexidade = 'Alta complexidade'n then
weight = count / total_obs * 0.10;

drop total_obs;
run;

/* Etapa 5: Amostragem aleatória ponderada por operador e complexidade */
proc surveyselect data=amostra_final
method=urs
out=amostra_ponderada
outhits;
strata operador;
weight weight;
runoncelist operador / groupprior;
run;

 

Porem esta aparecendo este erro: ERROR 180-322: Statement is not valid or it is used out of proper order. Como resolver este problema?

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Please show us the entire log whenever there is an error. We don't want you to show us just the error messages, we need to see everything in the log down to and including the error message.

--
Paige Miller
Lucasmarques94
Calcite | Level 5
Segue o erro e o log:
1 The SAS System 11:10 Sunday, November 12, 2023

1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Program (2)';
4 %LET _CLIENTPROCESSFLOWNAME='MULTISKILLS';
5 %LET _CLIENTPROJECTPATH='D:\Users\e256967\Desktop\teste monitoria callcenter.egp';
6 %LET _CLIENTPROJECTPATHHOST='MICP5300122037';
7 %LET _CLIENTPROJECTNAME='teste monitoria callcenter.egp';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 FILENAME EGSR TEMP;
15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16 STYLE=HtmlBlue
17 STYLESHEET=(URL="file:///D:/SAS94/x86/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
18 NOGTITLE
19 NOGFOOTNOTE
20 GPATH=&sasworklocation
21 ENCODING=UTF8
22 options(rolap="on")
23 ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24
25 GOPTIONS ACCESSIBLE;
26 /* Etapa 1: Classificar os dados pelo operador e pela complexidade */
27 proc sort data=QUERY_FOR_MULTISKILLS;
28 by operador complexidade;
29 run;

ERROR: You cannot open WORK.QUERY_FOR_MULTISKILLS.DATA for output access with member-level control because
WORK.QUERY_FOR_MULTISKILLS.DATA is in use by you in resource environment SORT (2).
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

30
31 /* Etapa 2: Calcular o tamanho da amostra para cada operador e complexidade */


32 proc freq data=QUERY_FOR_MULTISKILLS noprint;
33 tables operador*complexidade / out=amostra_tamanho nofreq nopercent norow;
34 run;

NOTE: There were 10699 observations read from the data set WORK.QUERY_FOR_MULTISKILLS.
NOTE: The data set WORK.AMOSTRA_TAMANHO has 360 observations and 4 variables.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.09 seconds
cpu time 0.01 seconds


35
36 /* Etapa 3: Calcular a porcentagem para cada operador e complexidade */
37 data amostra_porcentagem;
38 set amostra_tamanho;
39 total_obs + count;
2 The SAS System 11:10 Sunday, November 12, 2023

40 run;

NOTE: There were 360 observations read from the data set WORK.AMOSTRA_TAMANHO.
NOTE: The data set WORK.AMOSTRA_PORCENTAGEM has 360 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds


41
42 /* Etapa 4: Amostragem estratificada para atingir a distribuição desejada */
43 data amostra_final;
44 set QUERY_FOR_MULTISKILLS;
45 if complexidade = 'Baixa complexidade'n then
46 weight = count / total_obs * 0.55;
47 else if complexidade = 'Média complexidade'n then
48 weight = count / total_obs * 0.35;
49 else if complexidade = 'Alta complexidade'n then
50 weight = count / total_obs * 0.10;
51
52 drop total_obs;
53 run;

NOTE: Variable 'Baixa complexidade'n is uninitialized.
NOTE: Variable total_obs is uninitialized.
NOTE: Variable count is uninitialized.
NOTE: Variable 'Média complexidade'n is uninitialized.
NOTE: Variable 'Alta complexidade'n is uninitialized.
NOTE: There were 10699 observations read from the data set WORK.QUERY_FOR_MULTISKILLS.
NOTE: The data set WORK.AMOSTRA_FINAL has 10699 observations and 26 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds


54
55 /* Etapa 5: Amostragem aleatória ponderada por operador e complexidade */
56 proc surveyselect data=amostra_final
57 method=urs
58 out=amostra_ponderada
59 outhits;
60 size=weight;
____
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

61 strata operador;
62 runoncelist operador / groupprior;
___________
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

63 run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.AMOSTRA_PONDERADA may be incomplete. When this step was stopped there were 0 observations and 0
variables.
NOTE: PROCEDURE SURVEYSELECT used (Total process time):
3 The SAS System 11:10 Sunday, November 12, 2023

real time 0.02 seconds
cpu time 0.00 seconds

64
65
66 GOPTIONS NOACCESSIBLE;
67 %LET _CLIENTTASKLABEL=;
68 %LET _CLIENTPROCESSFLOWNAME=;
69 %LET _CLIENTPROJECTPATH=;
70 %LET _CLIENTPROJECTPATHHOST=;
71 %LET _CLIENTPROJECTNAME=;
72 %LET _SASPROGRAMFILE=;
73 %LET _SASPROGRAMFILEHOST=;
74
75 ;*';*";*/;quit;run;
76 ODS _ALL_ CLOSE;
77
78
79 QUIT; RUN;
80
PaigeMiller
Diamond | Level 26

Please take a careful look at the documentation for PROC SURVEYSELECT.

 

The SIZE statement does not have an equal sign. There is no RUNONCELIST command. And there may be other errors which I didn't spot.

 

 

--
Paige Miller