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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 3590 views
  • 1 like
  • 3 in conversation