BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
/*Read multiple txt files*/

/*Method One*/

filename t 'C:\Users\Anand\Desktop\Pandas_rawdata\multiplefilesforreading\*.txt'		;
	data multi;
	infile t;
	input Name$ Sex$ Age $Height$ Weight$;
	proc print;run;


/*Method Two*/
%macro import_multitext(fname);

proc import 
datafile="C:\Users\Anand\Desktop\Pandas_rawdata\multiplefilesforreading/&fname..txt"
out=imptext.&fname.
dbms=tab
replace
;
run;

%mend;
%import_multitext(Class_1.txt);

Here I am trying to read text files at  at time 

I got problem in 1st method   variables names also get two times

and 2nd method i didn't get output 

 

6 REPLIES 6
ChrisNZ
Tourmaline | Level 20

> I got problem in 1st method   variables names also get two times

I do not understand

 

> and 2nd method i didn't get output 

Unsurprising.  

%import_multitext(Class_1);

might work better.

BrahmanandaRao
Lapis Lazuli | Level 10
Error Libname not assign
ChrisNZ
Tourmaline | Level 20

If you want answers, provide information. What sort of reply is this? 

This error message is not even accurate, and has nothing to do with the issue described so far.

Show us the log. Describe the problem. Provide the exact code used. Help us help you.

 

BrahmanandaRao
Lapis Lazuli | Level 10
Spoiler
Anandkvn_0-1606288987855.png

 

ChrisNZ
Tourmaline | Level 20

The message states the library NAME is not assigned.

This library is not used (or defined) in the code shown.

Please ask a question that we can answer by provide a single, comprehensive, version of what you are doing.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 6 replies
  • 626 views
  • 0 likes
  • 3 in conversation