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

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

Difference between revisions of "Tips:Retaining Quotes in a Input statement"

From sasCommunity
Jump to: navigation, search
(tip ready)
(Scheduled July 22, 2011)
Line 32: Line 32:
[[Category:Tip Ready]]
[[Category:Tip in Use]]
[[Category:Base SAS]]
[[Category:Base SAS]]
[[Category:DATA Step]]
[[Category:DATA Step]]

Revision as of 22:13, 17 July 2011

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 $;
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
                        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