Write and run SAS programs in your web browser

The first variable did not show observe on the output (compare music and music2)

Accepted Solution Solved
Reply
Highlighted
Contributor
Posts: 20
Accepted Solution

The first variable did not show observe on the output (compare music and music2)

%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!


Accepted Solutions
Solution
3 weeks ago
Contributor
Posts: 20

Re: The first variable did not show observe on the output (compare music and music2)

Posted in reply to KurtBremser
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. ThanksSmiley Happy

View solution in original post


All Replies
Super User
Posts: 8,590

Re: The first variable did not show observe on the output (compare music and music2)

Much more interesting than the output would be the infile to run the code against.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Solution
3 weeks ago
Contributor
Posts: 20

Re: The first variable did not show observe on the output (compare music and music2)

Posted in reply to KurtBremser
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. ThanksSmiley Happy

Super User
Posts: 21,546

Re: The first variable did not show observe on the output (compare music and music2)

[ Edited ]

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!



 

Contributor
Posts: 20

Re: The first variable did not show observe on the output (compare music and music2)

Thank you very much!! It works! thanks!

Super User
Posts: 12,148

Re: The first variable did not show observe on the output (compare music and music2)


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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 119 views
  • 1 like
  • 4 in conversation