BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jc3992
Pyrite | Level 9
%let dirLSB=/folders/myfolders/;

data music;
	infile '&dirLSB.Bands.csv' DLM=',' dsd missover termstr=CRLF;
	length Band_name$ 30 Gig_date$ 10;
	input Band_name$ Gig_date$ Eight_PM Nine_PM Ten_PM Eleven_PM;
run;
proc print data=music;
run;

data music2;
proc import datafile="&dirLSB.Bands2.csv" out=music2 replace;
run;

proc compare base=music compare=music2;
title 'music vs music2';
run;

Hello everyone, 

I have included my output as attached. Any hint or correction is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
jc3992
Pyrite | Level 9
data music;
	infile '/folders/myfolders/Bands.csv' DLM=',' dsd missover;
	length Band_name$ 30 Gig_date$ 10;
	input Band_name$ Gig_date$ Eight_PM Nine_PM Ten_PM Eleven_PM;
run;


data music2;
proc import datafile="&dirLSB.Bands2.csv" out=music2 replace;
run;

proc compare base=music compare=music2;
title 'music vs music2';
run;

I used this instead and it worked. Thanks:)

View solution in original post

5 REPLIES 5
jc3992
Pyrite | Level 9
data music;
	infile '/folders/myfolders/Bands.csv' DLM=',' dsd missover;
	length Band_name$ 30 Gig_date$ 10;
	input Band_name$ Gig_date$ Eight_PM Nine_PM Ten_PM Eleven_PM;
run;


data music2;
proc import datafile="&dirLSB.Bands2.csv" out=music2 replace;
run;

proc compare base=music compare=music2;
title 'music vs music2';
run;

I used this instead and it worked. Thanks:)

Reeza
Super User

Your code wouldn't run properly so your log should have errors. 

 

See my comments below:

 

%let dirLSB=/folders/myfolders/;

data music;
	infile '&dirLSB.Bands.csv' DLM=',' dsd missover termstr=CRLF; %* needs double not single quotes. Macro variables do not resolve in single quotes so the file would not be read;
	length Band_name$ 30 Gig_date$ 10;
	input Band_name$ Gig_date$ Eight_PM Nine_PM Ten_PM Eleven_PM;
run;
proc print data=music;
run;

data music2; *This line does nothing and shouldn't be here. Delete it;
proc import datafile="&dirLSB.Bands2.csv" out=music2 replace; %* this is missing DBMS=CSV;
run;

proc compare base=music compare=music2;
title 'music vs music2';
run;

 


@jc3992 wrote:
%let dirLSB=/folders/myfolders/;

data music;
	infile '&dirLSB.Bands.csv' DLM=',' dsd missover termstr=CRLF;
	length Band_name$ 30 Gig_date$ 10;
	input Band_name$ Gig_date$ Eight_PM Nine_PM Ten_PM Eleven_PM;
run;
proc print data=music;
run;

data music2;
proc import datafile="&dirLSB.Bands2.csv" out=music2 replace;
run;

proc compare base=music compare=music2;
title 'music vs music2';
run;

Hello everyone, 

I have included my output as attached. Any hint or correction is appreciated!



 

jc3992
Pyrite | Level 9

Thank you very much!! It works! thanks!

ballardw
Super User

@jc3992 wrote:
%let dirLSB=/folders/myfolders/;

data music;
	infile '&dirLSB.Bands.csv' DLM=',' dsd missover termstr=CRLF;
	length Band_name$ 30 Gig_date$ 10;
	input Band_name$ Gig_date$ Eight_PM Nine_PM Ten_PM Eleven_PM;
run;
proc print data=music;
run;

data music2;
proc import datafile="&dirLSB.Bands2.csv" out=music2 replace;
run;

proc compare base=music compare=music2;
title 'music vs music2';
run;

Hello everyone, 

I have included my output as attached. Any hint or correction is appreciated!


data music would not be created properly (no records) because the single quotes in the infile statement keep the macro variable from resolving.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 5 replies
  • 1668 views
  • 1 like
  • 4 in conversation