BookmarkSubscribeRSS Feed
nee14
Calcite | Level 5

I am transferring from SAS 9.2 to EG and having trouble importing data from 9.2 to EG.  Our EG server is not linked to the data from the windows based server.  Below is my code and have been getting the :

ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &PBIS_DDRS. = PBIS

ERROR: The macro PBIS_DRIVE will stop executing.

%MACRO PBIS_DRIVE(INPATH, FEED_SYS, PBIS_DDRS);                                                                                                            
         
    %LET FILRF = MYINPATH;  

   

    %IF &FEED_SYS. = PBIS %THEN %LET FEED_SYS_CHECK = 0612;

%IF &FEED_SYS. = PBIS2 %THEN %LET FEED_SYS_CHECK = 0610;
%IF &FEED_SYS. = PBIS17 %THEN %LET FEED_SYS_CHECK = 20130703011526;

    %IF &FEED_SYS. = DDRS %THEN %LET FEED_SYS_CHECK = 1210;

    %IF &PBIS_DDRS. = PBIS17     %THEN %LET PBIS_DDRS = PBIS;

    %IF &PBIS_DDRS. = PBIS %THEN %LET PBIS_DDRS = PBIS;

    %IF &PBIS_DDRS. = PBIS2 %THEN %LET PBIS_DDRS = PBIS;

  %IF &PBIS_DDRS. = DDRS  %THEN %LET DAT_FILE = DDRS;

    /* ASSIGNS THE FILEREF OF MYINPATH TO THE INPATHECTORY AND OPENS THE INPATHECTORY */                                                              
    %LET RC=%SYSFUNC(FILENAME(FILRF,&INPATH));                                                                           
    %LET DID=%SYSFUNC(DOPEN(&FILRF));                                                                                               
                                                                                                                                  
    /* RETURNS THE NUMBER OF MEMBERS IN THE INPATHECTORY */                                                             

    %LET MEMCNT=%SYSFUNC(DNUM(&DID));

                                                                                                                                 
    /* LOOPS THROUGH ENTIRE INPATHECTORY */                                                                                            
    %DO I = 1 %TO &MEMCNT;                                                                                                          

   

   /* RETURNS THE FILE NAME TO THE NAME VARIABLE*/                                                                                                                              
   %LET FILE = %SYSFUNC(DREAD(&DID, &I));
   %IF %SYSFUNC(FIND(&FILE, &FEED_SYS)) > 0 %THEN %DO;

    DATA PBIS_17_TEMP (DROP = BASIC_SYMBOL);

    FORMAT INPUT $19.

        NEW_BASIC_SYMBOL $4.
        GLAC $32.
        AMOUNT_JUN 32.2
        AMOUNT_SEP 32.2;
                              

    INFILE "&INPATH./PBIS/&FILE." MISSOVER DSD LRECL=3699 FIRSTOBS = 2;

    INPUT @1 FISCAL_YR_MO $6.

      @7 DEPARTMENT $2.
      @9 BASIC_SYMBOL $7.
      @16 BEG_BUDGET_YR $4.
      @20 END_BUDGET_YR $4.
      @24 MAJOR_COMMAND $3.
      @27 SUBHEAD $5.
      @32 ORG_CD $7.
      @39 OB_HOLDER $5.
      @44 OB_HOLDER2 $1.
      @45 GL_ACCT_NR $9.
      @54 SAG $2.
      @56 CHARGEABLE $6.
      @62 TRANS_DEPARTMENT $6.
      @68 AAA $6.
      @74 AMOUNT_PACKED $18.
      @92 ACCT_PERIOD $1.
      @93 OBJ_CLS $3.
      @96 STATE_CD $2.
      @98 PROJ_CD $5.
      @103 FUNCTION $1.
      @104 SF $1.
      @105 FAN $5.
      @110 EE $1.
      @111 NAVY_RSC $4.
      @115 FEED_SYS_ID $8.
      @123 GL_TYPE $4.
      @127 PROJ_AUTH_FY $4.
      @131 PROJ_AUTH_FY_SX $1.
      @132 PROJ_UIC $6.
      @138 CNTY_CD $2.
      @140 PGM_ELEMENT $13.
      @153 PROJ_TASK_ID $11.
      @164 PDLI_CD $3.
      @167 PDLI_SX $1.
      @168 PGM_CAT_CD $3.
      @171 ITEM_CD $2.
      @173 PROC_TRN_CD $2.
      @175 PBAS_REQ_NR $14.
      @189 FILLER $61.;

    IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('{', '}') THEN AMOUNT_UNPACKED = '0';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('A', 'J') THEN AMOUNT_UNPACKED = '1';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('B', 'K') THEN AMOUNT_UNPACKED = '2';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('C', 'L') THEN AMOUNT_UNPACKED = '3';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('D', 'M') THEN AMOUNT_UNPACKED = '4';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('E', 'N') THEN AMOUNT_UNPACKED = '5';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('F', 'O') THEN AMOUNT_UNPACKED = '6';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('G', 'P') THEN AMOUNT_UNPACKED = '7';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('H', 'Q') THEN AMOUNT_UNPACKED = '8';

    ELSE IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('I', 'R') THEN AMOUNT_UNPACKED = '9';

    ELSE AMOUNT_UNPACKED = '0';

   

    IF NOT MISSING(AMOUNT_PACKED) THEN DO;

    IF SUBSTR(AMOUNT_PACKED, LENGTH(AMOUNT_PACKED), 1) IN ('}','J','K','L','M','N','O','P','Q','R') THEN

   AMOUNT_JUN = -1 * INPUT(SUBSTR(AMOUNT_PACKED,1,LENGTH(AMOUNT_PACKED)-1) || AMOUNT_UNPACKED, 32.)/100;

    ELSE AMOUNT_JUN = INPUT(SUBSTR(AMOUNT_PACKED,1,LENGTH(AMOUNT_PACKED)-1) || AMOUNT_UNPACKED, 32.)/100;

    END;

    ELSE AMOUNT_JUN = 0;

    INPUT = "PBIS 17";

    NEW_BASIC_SYMBOL = SUBSTR(BASIC_SYMBOL, 1, 4);

    GLAC = GL_ACCT_NR;

    AMOUNT_SEP = 0;

RUN;

DATA PBIS17_&QTR.&YEAR.;

    SET PBIS_17_TEMP;

RUN;

   %END;   

   

   %END;   

                                                                                                                                  
  /* CLOSES THE INPATHECTORY */                                                                                                      
  %LET RC=%SYSFUNC(DCLOSE(&DID));                                                                                                  
                                                                                                                                  

%MEND;

%PBIS_DRIVE(/data/Navy_FMO/Audit Readiness/SEGMENTS/FSCR/Steps 0 - 4/FY13/Q3/Raw Data/PBIS, PBIS, PBIS17-SYSGEN_20130703011526);

4 REPLIES 4
LinusH
Tourmaline | Level 20

Hold it -  data access is one thing, a macro execution something else. What is the problem?

Describe your issue in more detail.

From SAS 9.2 on a Windows client/server, data stored in SAS tables (data sets)?

New EG, talking to client or remote SAS server? New server? Where is the data?

Data never sleeps
nee14
Calcite | Level 5

From SAS 9.2 raw data - txt  &dat files

new EG i its a remote SAS server.  the remote server will pull raw files from the old windows (winshare) environment.

Tom
Super User Tom
Super User

From the error message is sounds like the error could be because the macro is not properly quoting macro variable value references.

This could confuse the implied %EVAL() used in the %IF statement.  You might not have had this issue in your old environment because of the values used for the macro variables did not include things that made SAS think you were trying to compare numbers.

The one it is complaining about is the third parameter in your macro call.  You might be able to fix it by quoting the value on the way into the macro.  Note you can include the parameter names in you macro call even when you have defined them as positional in the definition. This will make the macro call easier to read and understand.

%PBIS_DRIVE

(INPATH=/data/Navy_FMO/Audit Readiness/SEGMENTS/FSCR/Steps 0 - 4/FY13/Q3/Raw Data/PBIS

,FEED_SYS= PBIS

,PBIS_DDRS= %quote(PBIS17-SYSGEN_20130703011526)

);


jakarman
Barite | Level 11

your are using spaces and - in some fields without taking care of possible side effects. Agree with Tom it is the: PBIS17-SYSGEN_20130703011526

The error message could be one line statement wrong. Debugging options for macro processing should help you.

options mprint mlogic symbolgen source2;

---->-- ja karman --<-----

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1218 views
  • 0 likes
  • 4 in conversation