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
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)
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)
that is because the , is within a quoted string. DLM works with the cards not the quoted strings you have.
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
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!
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.
Ready to level-up your skills? Choose your own adventure.