As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips:Retaining Quotes in a Input statement

From sasCommunity
Jump to: navigation, search

Occasionally, some SAS users might need to use a simple data step with datalines input. However, for certain cases, quoted text might be required. Under normal circumstances, this will cause error due to delimiters in data. However, we can use the tilde format modifier to change the behavior of how the data are read in.

data scores;
   infile datalines dsd;
   input Name : $9. Score1-Score3 
         Team ~ $25. Div $;
   datalines;
Joseph,11,32,76,"Red Racers, Washington",AAA
Mitchel,13,29,82,"Blue Bunnies, Richmond",AAA
Sue Ellen,14,27,74,"Green Gazelles, Atlanta",AA
;
run;
                        The SAS System                        1
 
OBS Name      Score1 Score2 Score3           Team            Div
 
 1  Joseph      11     32     76   "Red Racers, Washington"  AAA
 2  Mitchel     13     29     82   "Blue Bunnies, Richmond"  AAA
 3  Sue Ellen   14     27     74   "Green Gazelles, Atlanta" AA

Submitted by Murphy Choy. Contact me at my Discussion Page.

....see also