getting error

Reply
Occasional Contributor
Posts: 10

getting error


Hi,

what is the solution to fix the initializaiton error.

ERROR:  file  XXX.XXXdata does not exist.

However  second time I am getting the result what I expected.

Any help!

Thanks,

Super User
Posts: 11,134

Re: getting error

Kind of scanty information to diagnose with.

Version of SAS? University Edition? Using Enterprise Guide?

Code you are running? Reading or writing to the file? HOW?

Occasional Contributor
Posts: 10

Re: getting error

Hi Ballardw!

Am using SAS V9.2.   The project is  SAS/AF

The program files in UNIX and SAS is in Windows7 enterprise.

When I select a frame it has to read the file from UNIX and provide output with values.

The code as ffollow:

%macro coverage;                                                                                                           

    %LET mstring=;                                                                                                                                                                                   

    proc sql noprint;                                                                                                                                                                             

    select distinct agitem into: agiItemstring separated by '  '                                                                                                                        

    from popp.bdy                                                                                                                                                                     

   where state=&st and sap=&sap;                                                                                                                                                        

    quit ;                                                                                                                                                                                   ;

    run;

   %put &agiItemstring;        

                                                                                                                                                                                 

   %LET LOOP=1;                                                                                                                                                                         

   %LET item=%SCAN(&agiItemString,&LOOP,' ') ;                                                                                                                                         

   %DO %UNTIL(&item=%STR());                                                                                                                                                           

   

   %PUT   item IS     ***********  &item  **********************;                                                                                                                      

        proc sql ;                                                                                                                                                                             

        create table ppSum as                                                                                                                                                         

        select sum(i&item) as pp_sum                                                                                                                                                      

        from prfile.prfile&item                                                                                                                                                  

        where pod in  ( select pod from ppdata.pp&smp );                                                                                                                          

       quit;                                                                                                                                                                          

       proc sql ;                                                                                                                                                                     

      create table sapSm as                                                                                                                                                        

       select sum(i&item) as saple_sum                                                                                                                                                   

        from prfile.prfile&item                                                                                                                                                      

        where pod in  ( select pod from smdata.smp&smp );                                                                                                                         

        quit;                                                                                                                                                                          

                                                                                                                                                                                

        proc sql;                                                                                                                                                                      

        create table covrge as                                                                                                                                                     

        select &item as agrItem, ((saple_sum/pp_sum)*100 ) as P_coverage format 8.1                                                                                                     

         from ppsum as a, sapSum as b;                                                                                                                                               

         quit;                                                                                                                                                                         

         proc append data=coverage base=combined_coverage;                                                                                                                                      

      run;                                                                                                                                                                                   

       

   %LET LOOP=%EVAL(&LOOP+1);                                                                                                                                                              

   %PUT &item;                                                                                                                                                                            

   %LET item=%SCAN(&agiItemString,&LOOP,' ') ;                                                                                                                                           

   %END;                                                                                                                                                                                  

    proc sql noprint;                                                                                                                                                                      

   select agiItem, p_coverage   into :agiItemString separated by ' ', Smiley Tongue_coverageString                                                                                                 

   separated by ' '                                                                                                                                                                        

   from combined_coverage;                                                                                                                                                                

   quit;                                                                                                                                                                                  

   proc print data=combined_coverage;                                                                                                                                                     

   title1 "pcnt coverage for Sap&item for state: &st";                                                                                                                                        

   run;                                                                                                                                                                                   

   proc datasets lib=work;                                                                                                                                                                

   delete combined_coverage;                                                                                                                                                            

   run;                                                                                                                                                                                 

  %mend coverage;                                                                                                                                                                        

 

  %coverage;


Trusted Advisor
Posts: 2,114

Re: getting error

If it runs the second time, but not the first, in a single interactive SAS session, I would suspect that you are using the file before declaring its location to SAS (by a filename or libname statement).  When you get to the second execution, the declaration has be executed and the file can be located.

Occasional Contributor
Posts: 10

Re: getting error

HI Doc!

The program file is the same which was working fine but the problem with the I wrote to the same SAS.file in UNIX environment.

The program run fine till the previous code as usal and output............without the values for the code I wrote to the same file.

But if the user select the same buttion the program runing fine along with the code I wrote and getting the expected  values along withe the previous one.

Thanks,

Ask a Question
Discussion stats
  • 4 replies
  • 237 views
  • 0 likes
  • 3 in conversation