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
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: