BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

Dear,

 

I am using below pgm to convert xpt files in folder to sas data sets. I am getting syntax error. XPT datasets are in rt1 folder. The output sas datasets will go rt2 folder in my pgm.

filename tmp pipe "dir /b ""abc/programs/qc/archive/rt1/*.xpt""";

libname ms "abc/programs/qc/archive/rt2";
data _null_;
  infile tmp;
  input;
  call execute(cats('filename xptfile "abc/programs/qc/archive/rt1/', _input_'"));
  call execute('proc copy inlib=xptfile outlib=ms; run;');
  call execute('filename xptfile clear;');
run;

Please suggest. Thank you

3 REPLIES 3
mkeintz
PROC Star

Show the sas log, with reprinted sas statements, and SAS notes and messages regarding your question.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
knveraraju91
Barite | Level 11
Thank you for your time. I could not resolve it. Please suggest

Here is log
NOTE: CALL EXECUTE generated line.
1 + filename xptfile "abc/programs/qc/archive/rt1/, _input_"
NOTE: Line generated by the CALL EXECUTE routine.
2 + proc copy inlib=xptfile outlib=ms;
____
23
ERROR 23-2: Invalid option name proc.

2 !+ proc copy inlib=xptfile outlib=ms;
____
23
ERROR 23-2: Invalid option name copy.

2 !+ proc copy inlib=xptfile outlib=ms;
_____
23
ERROR 23-2: Invalid option name inlib.

2 !+ proc copy inlib=xptfile outlib=ms;
______
23
ERROR: Error in the FILENAME statement.
ERROR 23-2: Invalid option name outlib.

3 + filename xptfile clear;
3 The SAS System

WARNING: No logical assign for filename XPTFILE.
4 + filename xptfile "abc/programs/qc/archive/rt1/, _input_"
NOTE: Line generated by the CALL EXECUTE routine.
5 + proc copy inlib=xptfile outlib=ms;
____
23
ERROR 23-2: Invalid option name proc.

5 !+ proc copy inlib=xptfile outlib=ms;
____
23
ERROR 23-2: Invalid option name copy.

5 !+ proc copy inlib=xptfile outlib=ms;
_____
23
ERROR 23-2: Invalid option name inlib.

5 !+ proc copy inlib=xptfile outlib=ms;
______
23
ERROR: Error in the FILENAME statement.
ERROR 23-2: Invalid option name outlib.

6 + filename xptfile clear;
WARNING: No logical assign for filename XPTFILE.
ballardw
Super User

Check you quotes for unbalanced quotes. Just looking at the code as posted on the forum shows that the quotes aren't balanced because of the color the code text displays. The first Call execute is not closed properly.

 


@knveraraju91 wrote:

Dear,

 

I am using below pgm to convert xpt files in folder to sas data sets. I am getting syntax error. XPT datasets are in rt1 folder. The output sas datasets will go rt2 folder in my pgm.

filename tmp pipe "dir /b ""abc/programs/qc/archive/rt1/*.xpt""";

libname ms "abc/programs/qc/archive/rt2";
data _null_;
  infile tmp;
  input;
  call execute(cats('filename xptfile "abc/programs/qc/archive/rt1/', _input_'"));
  call execute('proc copy inlib=xptfile outlib=ms; run;');
  call execute('filename xptfile clear;');
run;

Please suggest. Thank you


 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 528 views
  • 0 likes
  • 3 in conversation