BookmarkSubscribeRSS Feed
Barkat
Pyrite | Level 9
Just replace truncover with dlm=" "

Then do,

proc freq data=final; where Week_Volume=0; table brand_name; run;
AlG
Quartz | Level 8 AlG
Quartz | Level 8

@Barkat  What I don't understand (and I apologize, I am very new to SAS) is the truncover.

All I do is I use proc import to import the csv dataset to sas. Something like below:

proc import datafile = 'C:\Users\alg\Merged\Final.csv'
out=Final   dbms = CSV replace; guessingrows=max; run;

Next, I do what you said:

proc freq data=final; where Week_Volume=0; table brand_name; run;

For which I get the error message.

That's all I do. Not sure what is truncover in this whole thing.

Barkat
Pyrite | Level 9
Sorry for making you confused.
The word "truncover" was in one of your posts where you provided the sample dataset. Forget that.

Anyway, most probably SAS is unable to read your data correctly. Could you send the result from the following two statements, please.

proc print data=final (obs=10); run;
proc contents data=final; run;
Reeza
Super User

Show your code and log please.

 


@AlG wrote:

@Barkat I get the same error. It says:

3641  data final1; set final;
3642  where Week_Volume=0;
ERROR: WHERE clause operator requires compatible variables.
3643  run;

 

AlG
Quartz | Level 8 AlG
Quartz | Level 8

@Reeza This is literally all I do:

proc import datafile = 'C:\Users\algMerged\Final.csv'
out=Final   dbms = CSV replace; guessingrows=max; run;


proc freq data=final; where Week_Volume=0; table brand_name; run;

And this is the log:

643  proc freq data=final; where Week_Volume=0; table brand_name; run;
ERROR: WHERE clause operator requires compatible variables.
Reeza
Super User
Post the full log. That isn't it.
AlG
Quartz | Level 8 AlG
Quartz | Level 8

@Reeza 

1    proc import datafile = 'C:\Users\algMerged\Final.csv'
2    out=Final   dbms = CSV replace;
2  !                                 guessingrows=max; run;

3     /**********************************************************************
4     *   PRODUCT:   SAS
5     *   VERSION:   9.4
6     *   CREATOR:   External File Interface
7     *   DATE:      16JUL20
8     *   DESC:      Generated SAS Datastep Code
9     *   TEMPLATE SOURCE:  (None Specified.)
10    ***********************************************************************/
11       data WORK.FINAL    ;
12       %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
13       infile 'C:\Users\algMerged\Final.csv' delimiter =
13 ! ',' MISSOVER DSD
14    lrecl=32767 firstobs=2 ;
15          informat brand_name $928. ;
16          informat sector $46. ;
17          informat date $11. ;
18          informat volume $24. ;
19          informat month $12. ;
20          informat adaware $15. ;
21          informat aided best32. ;
22          informat attention best32. ;
23          informat buzz best32. ;
24          informat consider best32. ;
25          informat current_own best32. ;
26          informat former_own best32. ;
27          informat impression best32. ;
28          informat index best32. ;
29          informat likelybuy best32. ;
30          informat quality best32. ;
31          informat recommend best32. ;
32          informat reputation best32. ;
33          informat satisfaction best32. ;
34          informat value best32. ;
35          informat wom best32. ;
36          informat Year0 best32. ;
37          informat week best32. ;
38          informat v1 best32. ;
39          informat author $11. ;
40          informat name $21. ;
41          informat MergeName $20. ;
42          informat industry $11. ;
43          informat country $28. ;
44          informat state $24. ;
45          informat city $13. ;
46          informat Week_Volume $5. ;
47          informat Sum_pronoun_i best32. ;
48          informat avg_pronoun_i $12. ;
49          informat Sum_pronoun_we best32. ;
50          informat avg_pronoun_we $12. ;
51          informat avg_valence best32. ;
52          informat Sum_P_competence $5. ;
53          informat avg_P_competence best32. ;
54          informat Sum_P_excitement $5. ;
55          informat avg_P_excitement best32. ;
56          informat Sum_P_ruggedness $5. ;
57          informat avg_P_ruggedness best32. ;
58          informat Sum_P_sincerity $5. ;
59          informat avg_P_sincerity best32. ;
60          informat Sum_P_sophistication $5. ;
61          informat avg_P_sophistication best32. ;
62          informat Sum_concreteness $12. ;
63          informat avg_concreteness best32. ;
64          informat Sum_averageconcretenesss $11. ;
65          informat avg_averageconcretenesss best32. ;
66          informat Sum_svm_price $5. ;
67          informat pct_svm_price $5. ;
68          informat Sum_svm_non_price $5. ;
69          informat pct_svm_non_price $5. ;
70          informat Sum_svm_brand $5. ;
71          informat pct_svm_brand $5. ;
72          informat Sum_svm_Positive $5. ;
73          informat pct_svm_Positive $5. ;
74          informat Sum_svm_neutral $5. ;
75          informat pct_svm_neutral $5. ;
76          informat Sum_svm_humorous $5. ;
77          informat pct_svm_humorous $5. ;
78          informat Sum_svm_advert $5. ;
79          informat pct_svm_advert $5. ;
80          informat Sum_svm_Nonadvert $5. ;
81          informat pct_svm_Nonadvert $5. ;
82          informat Sum_svm_calltoaction $5. ;
83          informat pct_svm_calltoaction $5. ;
84          informat Sum_svm_firm_focused $5. ;
85          informat pct_svm_firm_focused $5. ;
86          informat Sum_svm_Nonfirm_focused $5. ;
87          informat pct_svm_Nonfirm_focused $5. ;
88          informat Sum_svm_boastful $5. ;
89          informat pct_svm_boastful $5. ;
90          informat Sum_Naive_price $5. ;
91          informat pct_Naive_price $5. ;
92          informat Sum_Naive_non_price $5. ;
93          informat pct_Naive_non_price $5. ;
94          informat Sum_Naive_brand $5. ;
95          informat pct_Naive_brand $5. ;
96          informat Sum_Naive_Positive $5. ;
97          informat pct_Naive_Positive $5. ;
98          informat Sum_Naive_neutral $5. ;
99          informat pct_Naive_neutral $5. ;
100         informat Sum_Naive_humorous $5. ;
101         informat pct_Naive_humorous $5. ;
102         informat Sum_Naive_advert $5. ;
103         informat pct_Naive_advert $5. ;
104         informat Sum_Naive_Nonadvert $5. ;
105         informat pct_Naive_Nonadvert $5. ;
106         informat Sum_naive_calltoaction $5. ;
107         informat pct_naive_calltoaction $5. ;
108         informat Sum_Naive_firm_focused $5. ;
109         informat pct_Naive_firm_focused $5. ;
110         informat Sum_Naive_Nonfirm_focused $5. ;
111         informat pct_Naive_Nonfirm_focused $5. ;
112         informat Sum_Naive_boastful $5. ;
113         informat pct_Naive_boastful $5. ;
114         informat Sum_Knn_price $5. ;
115         informat pct_Knn_price $5. ;
116         informat Sum_Knn_non_price $5. ;
117         informat pct_Knn_non_price $5. ;
118         informat Sum_Knn_brand $5. ;
119         informat pct_Knn_brand $5. ;
120         informat Sum_Knn_Positive $5. ;
121         informat pct_Knn_Positive $5. ;
122         informat Sum_Knn_neutral $5. ;
123         informat pct_Knn_neutral $5. ;
124         informat Sum_Knn_humorous $5. ;
125         informat pct_Knn_humorous $5. ;
126         informat Sum_Knn_advert $5. ;
127         informat pct_Knn_advert $5. ;
128         informat Sum_Knn_Nonadvert $5. ;
129         informat pct_Knn_Nonadvert $5. ;
130         informat Sum_knn_calltoaction $5. ;
131         informat pct_knn_calltoaction $5. ;
132         informat Sum_Knn_firm_focused $5. ;
133         informat pct_Knn_firm_focused $5. ;
134         informat Sum_Knn_Nonfirm_focused $4. ;
135         informat pct_Knn_Nonfirm_focused $5. ;
136         informat Sum_Knn_boastful $5. ;
137         informat pct_Knn_boastful $5. ;
138         informat Sum_Cnn_price $5. ;
139         informat pct_Cnn_price $5. ;
140         informat Sum_Cnn_non_price $5. ;
141         informat pct_Cnn_non_price $5. ;
142         informat Sum_Cnn_brand $5. ;
143         informat pct_Cnn_brand $5. ;
144         informat Sum_Cnn_Positive $5. ;
145         informat pct_Cnn_Positive $5. ;
146         informat Sum_Cnn_neutral $5. ;
147         informat pct_Cnn_neutral $5. ;
148         informat Sum_Cnn_humorous $5. ;
149         informat pct_Cnn_humorous $5. ;
150         informat Sum_Cnn_advert $5. ;
151         informat pct_Cnn_advert $5. ;
152         informat Sum_Cnn_Nonadvert $5. ;
153         informat pct_Cnn_Nonadvert $5. ;
154         informat Sum_cnn_calltoaction $5. ;
155         informat pct_cnn_calltoaction $5. ;
156         informat Sum_Cnn_firm_focused $5. ;
157         informat pct_Cnn_firm_focused $5. ;
158         informat Sum_Cnn_Nonfirm_focused $4. ;
159         informat pct_Cnn_Nonfirm_focused $5. ;
160         informat Sum_Cnn_boastful $5. ;
161         informat pct_Cnn_boastful $5. ;
162         informat Sum_LSTM_price $5. ;
163         informat pct_LSTM_price $5. ;
164         informat Sum_LSTM_non_price $5. ;
165         informat pct_LSTM_non_price $5. ;
166         informat Sum_LSTM_brand $5. ;
167         informat pct_LSTM_brand $5. ;
168         informat Sum_LSTM_Positive $5. ;
169         informat pct_LSTM_Positive $5. ;
170         informat Sum_LSTM_neutral $5. ;
171         informat pct_LSTM_neutral $5. ;
172         informat Sum_LSTM_humorous $5. ;
173         informat pct_LSTM_humorous $5. ;
174         informat Sum_LSTM_advert $5. ;
175         informat pct_LSTM_advert $5. ;
176         informat Sum_LSTM_Nonadvert $5. ;
177         informat pct_LSTM_Nonadvert $5. ;
178         informat Sum_lstm_calltoaction $5. ;
179         informat pct_lstm_calltoaction $5. ;
180         informat Sum_LSTM_firm_focused $5. ;
181         informat pct_LSTM_firm_focused $5. ;
182         informat Sum_LSTM_Nonfirm_focused $4. ;
183         informat pct_LSTM_Nonfirm_focused $5. ;
184         informat Sum_LSTM_boastful $5. ;
185         informat pct_LSTM_boastful $5. ;
186         informat Sum_BiLSTM_price best32. ;
187         informat pct_BiLSTM_price $17. ;
188         informat Sum_BiLSTM_non_price best32. ;
189         informat pct_BiLSTM_non_price $5. ;
190         informat Sum_BiLSTM_brand best32. ;
191         informat pct_BiLSTM_brand $12. ;
192         informat Sum_BiLSTM_Positive best32. ;
193         informat pct_BiLSTM_Positive $12. ;
194         informat Sum_BiLSTM_neutral best32. ;
195         informat pct_BiLSTM_neutral $12. ;
196         informat Sum_BiLSTM_humorous best32. ;
197         informat pct_BiLSTM_humorous $12. ;
198         informat Sum_BiLSTM_advert best32. ;
199         informat pct_BiLSTM_advert $5. ;
200         informat Sum_BiLSTM_Nonadvert best32. ;
201         informat pct_BiLSTM_Nonadvert $5. ;
202         informat Sum_bilstm_calltoaction best32. ;
203         informat pct_bilstm_calltoaction $5. ;
204         informat Sum_BiLSTM_firm_focused best32. ;
205         informat pct_BiLSTM_firm_focused $5. ;
206         informat Sum_BiLSTM_Nonfirm_focused best32. ;
207         informat pct_BiLSTM_Nonfirm_focused $5. ;
208         informat Sum_BiLSTM_boastful best32. ;
209         informat pct_BiLSTM_boastful $5. ;
210         informat Year best32. ;
211         informat GovWeek best32. ;
212         informat GovBrandName $20. ;
213         informat yearr best32. ;
214         informat GovWeekk best32. ;
215         informat Week_Internet best32. ;
216         informat Week_Magazines best32. ;
217         informat Week_Newspapers best32. ;
218         informat Week_Outdoor best32. ;
219         informat Week_Print best32. ;
220         informat Week_Radio best32. ;
221         informat Week_TV best32. ;
222         informat Week_Total best32. ;
223         format brand_name $928. ;
224         format sector $46. ;
225         format date $11. ;
226         format volume $24. ;
227         format month $12. ;
228         format adaware $15. ;
229         format aided best12. ;
230         format attention best12. ;
231         format buzz best12. ;
232         format consider best12. ;
233         format current_own best12. ;
234         format former_own best12. ;
235         format impression best12. ;
236         format index best12. ;
237         format likelybuy best12. ;
238         format quality best12. ;
239         format recommend best12. ;
240         format reputation best12. ;
241         format satisfaction best12. ;
242         format value best12. ;
243         format wom best12. ;
244         format Year0 best12. ;
245         format week best12. ;
246         format v1 best12. ;
247         format author $11. ;
248         format name $21. ;
249         format MergeName $20. ;
250         format industry $11. ;
251         format country $28. ;
252         format state $24. ;
253         format city $13. ;
254         format Week_Volume $5. ;
255         format Sum_pronoun_i best12. ;
256         format avg_pronoun_i $12. ;
257         format Sum_pronoun_we best12. ;
258         format avg_pronoun_we $12. ;
259         format avg_valence best12. ;
260         format Sum_P_competence $5. ;
261         format avg_P_competence best12. ;
262         format Sum_P_excitement $5. ;
263         format avg_P_excitement best12. ;
264         format Sum_P_ruggedness $5. ;
265         format avg_P_ruggedness best12. ;
266         format Sum_P_sincerity $5. ;
267         format avg_P_sincerity best12. ;
268         format Sum_P_sophistication $5. ;
269         format avg_P_sophistication best12. ;
270         format Sum_concreteness $12. ;
271         format avg_concreteness best12. ;
272         format Sum_averageconcretenesss $11. ;
273         format avg_averageconcretenesss best12. ;
274         format Sum_svm_price $5. ;
275         format pct_svm_price $5. ;
276         format Sum_svm_non_price $5. ;
277         format pct_svm_non_price $5. ;
278         format Sum_svm_brand $5. ;
279         format pct_svm_brand $5. ;
280         format Sum_svm_Positive $5. ;
281         format pct_svm_Positive $5. ;
282         format Sum_svm_neutral $5. ;
283         format pct_svm_neutral $5. ;
284         format Sum_svm_humorous $5. ;
285         format pct_svm_humorous $5. ;
286         format Sum_svm_advert $5. ;
287         format pct_svm_advert $5. ;
288         format Sum_svm_Nonadvert $5. ;
289         format pct_svm_Nonadvert $5. ;
290         format Sum_svm_calltoaction $5. ;
291         format pct_svm_calltoaction $5. ;
292         format Sum_svm_firm_focused $5. ;
293         format pct_svm_firm_focused $5. ;
294         format Sum_svm_Nonfirm_focused $5. ;
295         format pct_svm_Nonfirm_focused $5. ;
296         format Sum_svm_boastful $5. ;
297         format pct_svm_boastful $5. ;
298         format Sum_Naive_price $5. ;
299         format pct_Naive_price $5. ;
300         format Sum_Naive_non_price $5. ;
301         format pct_Naive_non_price $5. ;
302         format Sum_Naive_brand $5. ;
303         format pct_Naive_brand $5. ;
304         format Sum_Naive_Positive $5. ;
305         format pct_Naive_Positive $5. ;
306         format Sum_Naive_neutral $5. ;
307         format pct_Naive_neutral $5. ;
308         format Sum_Naive_humorous $5. ;
309         format pct_Naive_humorous $5. ;
310         format Sum_Naive_advert $5. ;
311         format pct_Naive_advert $5. ;
312         format Sum_Naive_Nonadvert $5. ;
313         format pct_Naive_Nonadvert $5. ;
314         format Sum_naive_calltoaction $5. ;
315         format pct_naive_calltoaction $5. ;
316         format Sum_Naive_firm_focused $5. ;
317         format pct_Naive_firm_focused $5. ;
318         format Sum_Naive_Nonfirm_focused $5. ;
319         format pct_Naive_Nonfirm_focused $5. ;
320         format Sum_Naive_boastful $5. ;
321         format pct_Naive_boastful $5. ;
322         format Sum_Knn_price $5. ;
323         format pct_Knn_price $5. ;
324         format Sum_Knn_non_price $5. ;
325         format pct_Knn_non_price $5. ;
326         format Sum_Knn_brand $5. ;
327         format pct_Knn_brand $5. ;
328         format Sum_Knn_Positive $5. ;
329         format pct_Knn_Positive $5. ;
330         format Sum_Knn_neutral $5. ;
331         format pct_Knn_neutral $5. ;
332         format Sum_Knn_humorous $5. ;
333         format pct_Knn_humorous $5. ;
334         format Sum_Knn_advert $5. ;
335         format pct_Knn_advert $5. ;
336         format Sum_Knn_Nonadvert $5. ;
337         format pct_Knn_Nonadvert $5. ;
338         format Sum_knn_calltoaction $5. ;
339         format pct_knn_calltoaction $5. ;
340         format Sum_Knn_firm_focused $5. ;
341         format pct_Knn_firm_focused $5. ;
342         format Sum_Knn_Nonfirm_focused $4. ;
343         format pct_Knn_Nonfirm_focused $5. ;
344         format Sum_Knn_boastful $5. ;
345         format pct_Knn_boastful $5. ;
346         format Sum_Cnn_price $5. ;
347         format pct_Cnn_price $5. ;
348         format Sum_Cnn_non_price $5. ;
349         format pct_Cnn_non_price $5. ;
350         format Sum_Cnn_brand $5. ;
351         format pct_Cnn_brand $5. ;
352         format Sum_Cnn_Positive $5. ;
353         format pct_Cnn_Positive $5. ;
354         format Sum_Cnn_neutral $5. ;
355         format pct_Cnn_neutral $5. ;
356         format Sum_Cnn_humorous $5. ;
357         format pct_Cnn_humorous $5. ;
358         format Sum_Cnn_advert $5. ;
359         format pct_Cnn_advert $5. ;
360         format Sum_Cnn_Nonadvert $5. ;
361         format pct_Cnn_Nonadvert $5. ;
362         format Sum_cnn_calltoaction $5. ;
363         format pct_cnn_calltoaction $5. ;
364         format Sum_Cnn_firm_focused $5. ;
365         format pct_Cnn_firm_focused $5. ;
366         format Sum_Cnn_Nonfirm_focused $4. ;
367         format pct_Cnn_Nonfirm_focused $5. ;
368         format Sum_Cnn_boastful $5. ;
369         format pct_Cnn_boastful $5. ;
370         format Sum_LSTM_price $5. ;
371         format pct_LSTM_price $5. ;
372         format Sum_LSTM_non_price $5. ;
373         format pct_LSTM_non_price $5. ;
374         format Sum_LSTM_brand $5. ;
375         format pct_LSTM_brand $5. ;
376         format Sum_LSTM_Positive $5. ;
377         format pct_LSTM_Positive $5. ;
378         format Sum_LSTM_neutral $5. ;
379         format pct_LSTM_neutral $5. ;
380         format Sum_LSTM_humorous $5. ;
381         format pct_LSTM_humorous $5. ;
382         format Sum_LSTM_advert $5. ;
383         format pct_LSTM_advert $5. ;
384         format Sum_LSTM_Nonadvert $5. ;
385         format pct_LSTM_Nonadvert $5. ;
386         format Sum_lstm_calltoaction $5. ;
387         format pct_lstm_calltoaction $5. ;
388         format Sum_LSTM_firm_focused $5. ;
389         format pct_LSTM_firm_focused $5. ;
390         format Sum_LSTM_Nonfirm_focused $4. ;
391         format pct_LSTM_Nonfirm_focused $5. ;
392         format Sum_LSTM_boastful $5. ;
393         format pct_LSTM_boastful $5. ;
394         format Sum_BiLSTM_price best12. ;
395         format pct_BiLSTM_price $17. ;
396         format Sum_BiLSTM_non_price best12. ;
397         format pct_BiLSTM_non_price $5. ;
398         format Sum_BiLSTM_brand best12. ;
399         format pct_BiLSTM_brand $12. ;
400         format Sum_BiLSTM_Positive best12. ;
401         format pct_BiLSTM_Positive $12. ;
402         format Sum_BiLSTM_neutral best12. ;
403         format pct_BiLSTM_neutral $12. ;
404         format Sum_BiLSTM_humorous best12. ;
405         format pct_BiLSTM_humorous $12. ;
406         format Sum_BiLSTM_advert best12. ;
407         format pct_BiLSTM_advert $5. ;
408         format Sum_BiLSTM_Nonadvert best12. ;
409         format pct_BiLSTM_Nonadvert $5. ;
410         format Sum_bilstm_calltoaction best12. ;
411         format pct_bilstm_calltoaction $5. ;
412         format Sum_BiLSTM_firm_focused best12. ;
413         format pct_BiLSTM_firm_focused $5. ;
414         format Sum_BiLSTM_Nonfirm_focused best12. ;
415         format pct_BiLSTM_Nonfirm_focused $5. ;
416         format Sum_BiLSTM_boastful best12. ;
417         format pct_BiLSTM_boastful $5. ;
418         format Year best12. ;
419         format GovWeek best12. ;
420         format GovBrandName $20. ;
421         format yearr best12. ;
422         format GovWeekk best12. ;
423         format Week_Internet best12. ;
424         format Week_Magazines best12. ;
425         format Week_Newspapers best12. ;
426         format Week_Outdoor best12. ;
427         format Week_Print best12. ;
428         format Week_Radio best12. ;
429         format Week_TV best12. ;
430         format Week_Total best12. ;
431      input
432                  brand_name  $
433                  sector  $
434                  date  $
435                  volume  $
436                  month  $
437                  adaware  $
438                  aided
439                  attention
440                  buzz
441                  consider
442                  current_own
443                  former_own
444                  impression
445                  index
446                  likelybuy
447                  quality
448                  recommend
449                  reputation
450                  satisfaction
451                  value
452                  wom
453                  Year0
454                  week
455                  v1
456                  author  $
457                  name  $
458                  MergeName  $
459                  industry  $
460                  country  $
461                  state  $
462                  city  $
463                  Week_Volume  $
464                  Sum_pronoun_i
465                  avg_pronoun_i  $
466                  Sum_pronoun_we
467                  avg_pronoun_we  $
468                  avg_valence
469                  Sum_P_competence  $
470                  avg_P_competence
471                  Sum_P_excitement  $
472                  avg_P_excitement
473                  Sum_P_ruggedness  $
474                  avg_P_ruggedness
475                  Sum_P_sincerity  $
476                  avg_P_sincerity
477                  Sum_P_sophistication  $
478                  avg_P_sophistication
479                  Sum_concreteness  $
480                  avg_concreteness
481                  Sum_averageconcretenesss  $
482                  avg_averageconcretenesss
483                  Sum_svm_price  $
484                  pct_svm_price  $
485                  Sum_svm_non_price  $
486                  pct_svm_non_price  $
487                  Sum_svm_brand  $
488                  pct_svm_brand  $
489                  Sum_svm_Positive  $
490                  pct_svm_Positive  $
491                  Sum_svm_neutral  $
492                  pct_svm_neutral  $
493                  Sum_svm_humorous  $
494                  pct_svm_humorous  $
495                  Sum_svm_advert  $
496                  pct_svm_advert  $
497                  Sum_svm_Nonadvert  $
498                  pct_svm_Nonadvert  $
499                  Sum_svm_calltoaction  $
500                  pct_svm_calltoaction  $
501                  Sum_svm_firm_focused  $
502                  pct_svm_firm_focused  $
503                  Sum_svm_Nonfirm_focused  $
504                  pct_svm_Nonfirm_focused  $
505                  Sum_svm_boastful  $
506                  pct_svm_boastful  $
507                  Sum_Naive_price  $
508                  pct_Naive_price  $
509                  Sum_Naive_non_price  $
510                  pct_Naive_non_price  $
511                  Sum_Naive_brand  $
512                  pct_Naive_brand  $
513                  Sum_Naive_Positive  $
514                  pct_Naive_Positive  $
515                  Sum_Naive_neutral  $
516                  pct_Naive_neutral  $
517                  Sum_Naive_humorous  $
518                  pct_Naive_humorous  $
519                  Sum_Naive_advert  $
520                  pct_Naive_advert  $
521                  Sum_Naive_Nonadvert  $
522                  pct_Naive_Nonadvert  $
523                  Sum_naive_calltoaction  $
524                  pct_naive_calltoaction  $
525                  Sum_Naive_firm_focused  $
526                  pct_Naive_firm_focused  $
527                  Sum_Naive_Nonfirm_focused  $
528                  pct_Naive_Nonfirm_focused  $
529                  Sum_Naive_boastful  $
530                  pct_Naive_boastful  $
531                  Sum_Knn_price  $
532                  pct_Knn_price  $
533                  Sum_Knn_non_price  $
534                  pct_Knn_non_price  $
535                  Sum_Knn_brand  $
536                  pct_Knn_brand  $
537                  Sum_Knn_Positive  $
538                  pct_Knn_Positive  $
539                  Sum_Knn_neutral  $
540                  pct_Knn_neutral  $
541                  Sum_Knn_humorous  $
542                  pct_Knn_humorous  $
543                  Sum_Knn_advert  $
544                  pct_Knn_advert  $
545                  Sum_Knn_Nonadvert  $
546                  pct_Knn_Nonadvert  $
547                  Sum_knn_calltoaction  $
548                  pct_knn_calltoaction  $
549                  Sum_Knn_firm_focused  $
550                  pct_Knn_firm_focused  $
551                  Sum_Knn_Nonfirm_focused  $
552                  pct_Knn_Nonfirm_focused  $
553                  Sum_Knn_boastful  $
554                  pct_Knn_boastful  $
555                  Sum_Cnn_price  $
556                  pct_Cnn_price  $
557                  Sum_Cnn_non_price  $
558                  pct_Cnn_non_price  $
559                  Sum_Cnn_brand  $
560                  pct_Cnn_brand  $
561                  Sum_Cnn_Positive  $
562                  pct_Cnn_Positive  $
563                  Sum_Cnn_neutral  $
564                  pct_Cnn_neutral  $
565                  Sum_Cnn_humorous  $
566                  pct_Cnn_humorous  $
567                  Sum_Cnn_advert  $
568                  pct_Cnn_advert  $
569                  Sum_Cnn_Nonadvert  $
570                  pct_Cnn_Nonadvert  $
571                  Sum_cnn_calltoaction  $
572                  pct_cnn_calltoaction  $
573                  Sum_Cnn_firm_focused  $
574                  pct_Cnn_firm_focused  $
575                  Sum_Cnn_Nonfirm_focused  $
576                  pct_Cnn_Nonfirm_focused  $
577                  Sum_Cnn_boastful  $
578                  pct_Cnn_boastful  $
579                  Sum_LSTM_price  $
580                  pct_LSTM_price  $
581                  Sum_LSTM_non_price  $
582                  pct_LSTM_non_price  $
583                  Sum_LSTM_brand  $
584                  pct_LSTM_brand  $
585                  Sum_LSTM_Positive  $
586                  pct_LSTM_Positive  $
587                  Sum_LSTM_neutral  $
588                  pct_LSTM_neutral  $
589                  Sum_LSTM_humorous  $
590                  pct_LSTM_humorous  $
591                  Sum_LSTM_advert  $
592                  pct_LSTM_advert  $
593                  Sum_LSTM_Nonadvert  $
594                  pct_LSTM_Nonadvert  $
595                  Sum_lstm_calltoaction  $
596                  pct_lstm_calltoaction  $
597                  Sum_LSTM_firm_focused  $
598                  pct_LSTM_firm_focused  $
599                  Sum_LSTM_Nonfirm_focused  $
600                  pct_LSTM_Nonfirm_focused  $
601                  Sum_LSTM_boastful  $
602                  pct_LSTM_boastful  $
603                  Sum_BiLSTM_price
604                  pct_BiLSTM_price  $
605                  Sum_BiLSTM_non_price
606                  pct_BiLSTM_non_price  $
607                  Sum_BiLSTM_brand
608                  pct_BiLSTM_brand  $
609                  Sum_BiLSTM_Positive
610                  pct_BiLSTM_Positive  $
611                  Sum_BiLSTM_neutral
612                  pct_BiLSTM_neutral  $
613                  Sum_BiLSTM_humorous
614                  pct_BiLSTM_humorous  $
615                  Sum_BiLSTM_advert
616                  pct_BiLSTM_advert  $
617                  Sum_BiLSTM_Nonadvert
618                  pct_BiLSTM_Nonadvert  $
619                  Sum_bilstm_calltoaction
620                  pct_bilstm_calltoaction  $
621                  Sum_BiLSTM_firm_focused
622                  pct_BiLSTM_firm_focused  $
623                  Sum_BiLSTM_Nonfirm_focused
624                  pct_BiLSTM_Nonfirm_focused  $
625                  Sum_BiLSTM_boastful
626                  pct_BiLSTM_boastful  $
627                  Year
628                  GovWeek
629                  GovBrandName  $
630                  yearr
631                  GovWeekk
632                  Week_Internet
633                  Week_Magazines
634                  Week_Newspapers
635                  Week_Outdoor
636                  Week_Print
637                  Week_Radio
638                  Week_TV
639                  Week_Total
640      ;
641      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
642      run;

NOTE: The infile 'C:\Users\algMerged\Final.csv' is:

      Filename=C:\Users\algMerged\Final.csv,
      RECFM=V,LRECL=32767,File Size (bytes)=24539805,
      Last Modified=15Jul2020:17:31:57,
      Create Time=15Jul2020:17:31:50

NOTE: 24250 records were read from the infile 'C:\Users\algMerged\Final.csv'.
      The minimum record length was 792.
      The maximum record length was 1238.
NOTE: The data set WORK.FINAL has 24250 observations and 208 variables.
NOTE: DATA statement used (Total process time):
      real time           0.45 seconds
      cpu time            0.39 seconds


24250 rows created in WORK.FINAL from C:\Users\algMerged\Final.csv.



NOTE: WORK.FINAL data set was successfully created.
NOTE: The data set WORK.FINAL has 24250 observations and 208 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           1:08.75
      cpu time            1:08.65



643  proc freq data=final; where Week_Volume=0; table brand_name; run;
ERROR: WHERE clause operator requires compatible variables.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE FREQ used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


Reeza
Super User
Ok, now look at your code and find the format and informat for your variable week_volume.
What does that tell you?
AlG
Quartz | Level 8 AlG
Quartz | Level 8

@Reeza  that it is a character variable?

Reeza
Super User
Yes. You've been consistently saying it's numeric. It's not.
So put the 0 in quotes in the WHERE statement and you're good to go.

That being said, I'd strongly recommend you review the import code and not use PROC IMPORT. Instead copy the code you posted, modify it so that your data is read in with the best type for the variable. For example if you try to sort your weeks, because it's character not numeric it will sort alphabetically. Which means it's Week 1 then Week 11, Week 12 ... Week 2, Week20, Week21 .... etc.
Taking the time to make sure you read in your data correctly will ALWAYS save you time later on and this is a prime example of that.
ballardw
Super User

That code:

data WORK.FINAL;
  infile datalines dsd truncover;
  input brand_name:$10. Year0:BEST12. week:BEST12. Week_Volume:BEST12.;
  format Year0 BEST12. week BEST12. Week_Volume BEST12.;
datalines;
Absolut 2014 6 4
Absolut 2014 7 0
Absolut 2014 8 0
Absolut 2015 0 2
Absolut 2015 1 6
;

has year0 week and week_volume with all missing values.

The DSD option is causing the single space between Absolut and 2014 to be part of the value and not a delimiter, as you can see if you print or view the data set.

I don't know if your code may have had tabs that were reduced to spaces so such but that data set is probably not actually representative of your data.

Barkat
Pyrite | Level 9

You may want to try something as below.

 

if Week_Volume1  =0 then do; count1=1; end;
if Week_Volume2  =0 then do; count2=1; end;
if Week_Volume3  =0 then do; count3=1; end;
if Week_Volume4  =0 then do; count4=1; end;
if Week_Volume5  =0 then do; count5=1; end;
if Week_Volume6  =0 then do; count6=1; end;
if Week_Volume7  =0 then do; count7=1; end;

 

zero_vol_wk = sum (of count1 - count7);

drop count1 - count7;

AlG
Quartz | Level 8 AlG
Quartz | Level 8

Thanks @Barkat . However, I don't get your code.

I have just one Week_Volume variable, but your code shows Week-Volume 1-7. I don't have such variables.

Barkat
Pyrite | Level 9

My bad!

Never mind. I thought you have data from many weeks.

AlG
Quartz | Level 8 AlG
Quartz | Level 8

@Barkat 

I do! I have 54 weeks for each firm, but just one column (week_volume), which indicates the volume of activity in a given week for a given firm.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 32 replies
  • 2152 views
  • 7 likes
  • 4 in conversation