BookmarkSubscribeRSS Feed
tbittl
Calcite | Level 5

Hello,

I try to import an ODM XML file via PROC CDISC into SAS datasets.

The following script was used in the past but now it occur a syntax error.

Till now I spend a lot of time to solve the error but I did not found anything.

Here is the error message (regarding SASDATASETNAME....):

6                  ODMMINIMUMKEYSET=NO             USENAMEASLABEL=YES;
6   ! CLINICALDATA OUT=OUT.&DSET             SASDATASETNAME="&DSET"
                                                           -
                                                           22
                                                           76
6   ! SITEREF=YES             INVESTIGATORREF=YES;     RUN;

ERROR 22-322: Syntax error, expecting one of the following: COMMENT, DOMAIN, DOMAINCODE,

          NAME, ORIGIN, PURPOSE, SASDATASETNAME.

ERROR 76-322: Syntax error, statement will be ignored.

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

I hope anybody in this community could help me.

Thanks in advance.

Kind regards,

Tanja

The following script I used:

/* Program Description:    Program to create a SAS dataset for every itemgroup within a XML ODM file */

/***** SAS Site number ********/

%put sitenumber: &SYSSITE;

/***** PROC CDISC VERSION *****/

proc cdisc version; run;

/************* ODM IMPORT **********************/

/* create filenames/libnames for XML ODM studydefs */

FILENAME XMLIMP 'Y:\...\dataexport_56881_2015-04-13_10-24-40.xml';

LIBNAME XMLIMP xml xmltype=CDISCODM FormatActive=No FormatNoReplace=No;

LIBNAME OUT 'Y:\...\SAS_data';

LIBNAME FLIB 'Y:\...\SAS_data';

%global DSETS;

/* MACRO for reading in ALL ItemGroups from ODM file in one step */

%MACRO ALLSETS (LIB, FLIB);

PROC SQL noprint;

SELECT UNIQUE MEMNAME INTO :DSETS SEPARATED BY '|'  

  FROM DICTIONARY.TABLES

  WHERE UPCASE(LIBNAME)="&LIB";

    %PUT DATASETS: &DSETS;

QUIT;

%LET NUM=1;

%LET DSET=%SCAN(%QUOTE(&DSETS),&NUM,|);

   %DO %UNTIL (%QUOTE(&DSET)=%STR());

      PROC CDISC MODEL=ODM

                 READ=XMLIMP

                FORMATACTIVE=YES

                FORMATNOREPLACE=NO                

                LANGUAGE="EN";

           ODM           ODMVERSION="1.2"

                             ODMMAXIMUMOIDLENGTH=20

                             ODMMINIMUMKEYSET=NO

                             USENAMEASLABEL=YES;

          CLINICALDATA OUT=OUT.&DSET

                  SASDATASETNAME="&DSET"

                  SITEREF=YES                     

                  INVESTIGATORREF=YES;          

        RUN;

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

        %LET DSET=%SCAN(%QUOTE(&DSETS),&NUM,|);

    %END;   

%MEND ALLSETS;

%ALLSETS (XMLIMP, FLIB);

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Whilst I don't use that toolkit, I could it be that you have a semi colon in the wrong place:

           ODM           ODMVERSION="1.2"

                             ODMMAXIMUMOIDLENGTH=20

                             ODMMINIMUMKEYSET=NO

                             USENAMEASLABEL=YES;               /* Here, is this semicolon valid? */

          CLINICALDATA OUT=OUT.&DSET

                  SASDATASETNAME="&DSET"

                  SITEREF=YES                    

If the above is ok, what does &DSET resolve to, do you have missing, or special characters?  options mlogic symbolgen mprint; then check that.  Also, I would as best practice, always put a full stop after the macro variable to ensure the compiler does not guess where the macro variable ends.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 630 views
  • 0 likes
  • 2 in conversation