Help using Base SAS procedures

Error Variable not found

Reply
Contributor
Posts: 24

Error Variable not found

Hello,

  I was just going through some simple nonparametric tests when I decided to try a procedure that would place two variables tha tI want to look at side by side in terms of frequency and counts, pre and post next to each other in a table:

 

609  proc freq ;

610     tables nihss lastmRs nihss*lastmRs / out=FreqCount outexpect sparse;

611     weight Count;

ERROR: Variable COUNT not found.

612     title 'nihss and lastmrS';

613  run;

 

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.FREQCOUNT may be incomplete.  When this step was stopped there were 0 observations and 0 variables.

NOTE: PROCEDURE FREQ used (Total process time):

      real time           0.01 seconds

      cpu time            0.00 seconds

 

 

 

614  proc print noobs;

615     title2 'Output Data Set from PROC FREQ';

616  run;

 

NOTE: No variables in data set WORK.FREQCOUNT.

NOTE: PROCEDURE PRINT used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

 

 

617  proc freq ;

618     tables nihss lastmRs nihss*lastmRs / out=FreqCount outexpect sparse;

ERROR: Variable NIHSS not found.

ERROR: Variable LASTMRS not found.

ERROR: Variable NIHSS not found.

ERROR: Variable LASTMRS not found.

619     weight Count;

ERROR: Variable COUNT not found.

620     title 'nihss and lastmrS';

621  run;

 

**first it said that count was not found, so then I decided to stop trying that procedure and go back to trying the other procedures and now my variables cannot be found:

 

627  proc ttest h0 = 50;

628    var age;

ERROR: Variable AGE not found.

629  run;

 

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE TTEST used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

 

 

I have no idea how to reverse this.  It seems to be stuck on that first procedure I wanted tot ry....

Super User
Posts: 17,829

Re: Error Variable not found

All of your Procs are missing DATA=DATASETNAME

 

You need to tell the proc what dataset to use. 

The default value is last created dataset, but there are exceptions so I recommend ALWAYS specifying it. 

 

 

Contributor
Posts: 24

Re: Error Variable not found

[ Edited ]

Ok-but that did not fix my bigger problem.  I was able to perform all of my proc steps without the data=statement for that past couple of hours, but once I tried the above procedure, it messed something up.  I want to be able to do that again, 

 

672  proc univariate data=iat.timetoiat;

673  histogram punctorecanal/normal;

674  run;

NOTE: PROCEDURE UNIVARIATE used (Total process time):

      real time           0.43 seconds

      cpu time            0.18 seconds

 

 

675  proc npar1way wilcoxon;

676    class sex;

ERROR: Variable SEX not found.

677    var time_to_nuero;

ERROR: Variable TIME_TO_NUERO not found.

678  run;

 

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE NPAR1WAY used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 second

Super User
Posts: 17,829

Re: Error Variable not found

Don't. 

Your going to run into errors or unexpected behaviour. 

Super User
Posts: 17,829

Re: Error Variable not found

Don't. 

Your going to run into errors or unexpected behaviour. 

Contributor
Posts: 24

Re: Error Variable not found

ok, I can do it agian (using the code below,  but now everything has a incorrect title...)

 

data iat;set iat.timetoiat;

proc print data=iat.timetoiat;

run;

Contributor
Posts: 24

Re: Error Variable not found

I figured it out, you do
title;

and it cancels all titles. thanks!
Super User
Posts: 17,829

Re: Error Variable not found

I really hope you do explicilty state your datasets...especially for future you or the analyst who has to read your code.

For example, what is the source data for the proc means statement, the class or temp2 dataset output from proc freq? And more importantly can you identify it without running the code.

data class;
set sashelp.class;
run;

proc freq data=class; table age*sex/out=temp2; run; proc means; run;

Anyways, if your question is answered please mark it as answered.

Super User
Posts: 17,829

Re: Error Variable not found

And it's actually likely the procedure before the Freq that messed things up since it doesn't have a data set to reference anymore. 

Ask a Question
Discussion stats
  • 8 replies
  • 973 views
  • 0 likes
  • 2 in conversation