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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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