Katerina
Katerina

Reputation: 1

why I cannot see my datafile on my defining library

I am running the following

%global source_dir util_dir paramf workdir datadir
    dataunitid 
    saserror 
    ;

%let datadir = %str(I:....\KATER\DATA);
%let outdir = %str(I:...\KATER\Results);


I set my library
libname datain "&datadir";
options mstored sasmstore=datain;

and then

%global liste_reg;
%let liste_reg=22 31;
%do k=1 %to %sysfunc(countw(&liste_reg.));
%let reg=%scan(&liste_reg.,&k.);
    data hh_record; set datain.hh_record_&reg.; run;
    data person_record; set datain.person_record_&reg.; run;
    %let outdir_ = &outdir.\output_&reg.;
     proc printto log = "&outdir_.Log.txt"; run; 

But I get an error:

ERROR: File DATAIN.PERSON_RECORD_.DATA does not exist.
ERROR: File DATAIN.HH_RECORD_.DATA does not exist.

why is this happening, How can I put my data in datain library?

I am new in SAS so i am little confused. In general I realised that there is nothing in both libraries?

EDIT full code:

%global source_dir util_dir paramf workdir datadir
    dataunitid 
    saserror 
;
%let source_dir = %str(I:...ONS_Transf_20170523);

*location of code;
%let util_dir = &source_dir.%str(\dsp_utils);
%let datadir = %str(...KATER\DATA);
%let outdir = %str(...\KATER\Results);
%let paramf = &datadir.%str(\parameter_file\param.csv);
options mautosource mrecall sasautos=(sasautos "&source_dir" "&util_dir")    nolabel;

%reset_saserror;
libname datain "&datadir";
options mstored sasmstore=datain;
libname outdir "&outdir.\output";
options mstored sasmstore=outdir;

%macro sdc_super_control_KAT;
    %global liste_reg;
    %let liste_reg=22 31;

    %do k=1 %to %sysfunc(countw(&liste_reg.));
        %let reg=%scan(&liste_reg.,&k.);

        data hh_record;
            set datain.hh_record_&reg.;
        run;

        data person_record;
            set datain.person_record_&reg.;
        run;

        %let outdir_ = &outdir.\output_&reg.;

        proc printto log = "&outdir_.Log.txt";
        run;

        /

        %sdc_control;

        *copy files to permanent library;
        proc copy in=work out=outdir_;
            select sdcresults_hh_:;
        run;

        proc printto;
        run;

    %end;

    data outdir.params;
        set diagnostics_params;
    run;

%mend sdc_super_control_KAT;

%sdc_super_control_KAT;

Upvotes: 0

Views: 57

Answers (1)

Allan Bowe
Allan Bowe

Reputation: 12691

I don't think you're showing us the full code. The issue above appears to be due to the &reg macro variable not resolving to a value but there is nothing shown to indicate why that would happen. Also, the error messages are in the wrong order (hh_record_) should come first in the log.

In summary, it's because your reg variable is resolving to a missing value, or because it is not found (if not found, the log should say that though).

Upvotes: 1

Related Questions