BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nirupama1
Fluorite | Level 6

Hi All,

 

I used below codes  i.e. with Tilde and without tilde(~). And getting the same result . Can yo explain why is it so?

 case1-

Data student;
infile cards dsd dlm=',';
Input id team $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;
proc print;
Run;

 

case 2-

Data student;
infile cards dsd dlm=',';
Input id team ~ $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;
proc print;
Run;

 

same outputfor both cases-

 

id            team

1 "Green House,NCSS"
2 "Green House,ABPS"
3 "Green House,JKLM"

 

 

While I expect to not receive quotes in output for case 1 scenario, as per the DSD fuctionality.

PLease explain Why getting same output.

 

Thanks,

Nirupama

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Data student;
infile cards dsd ;
Input id team : $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;

Data student1;
infile cards dsd ;
Input id team ~ :$25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;

 

 

 

EDIT: Applies only when you use list input and not formatted input (this is the reason)

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

Data student;
infile cards dsd ;
Input id team : $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;

Data student1;
infile cards dsd ;
Input id team ~ :$25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;

 

 

 

EDIT: Applies only when you use list input and not formatted input (this is the reason)

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

that is because the , is within a quoted string.  DLM works with the cards not the quoted strings you have.

 

novinosrin
Tourmaline | Level 20

No, 

 

run and see

Data student;
infile cards dsd dlm=',' ;
Input id team : $25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;

Data student1;
infile cards dsd  dlm=',';
Input id team ~ :$25.;
Cards;
1,"Green House,NCSS"
2,"Green House,ABPS"
3,"Green House,JKLM"
;

 The only change I did was using a colon format modifier to read team with a list input

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
  • 2761 views
  • 1 like
  • 3 in conversation