Sample 24596: Creating a delimited file using a PUT statement
Generate a file whose values are separated by the specified delimiter.
Note: The sample code on the Full Code tab creates a tilde-delimited file. However, you can specify any character or hex value in the DLM= option on the FILE statement. Use DLM='09'x for a tab delimited file on an ASCII platform, and '05'x on an EBCDIC platform.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
/* PONAME is a character variable and ZIP, Y and X are numeric */
/* variables. */
/* */
/* If you are writing out each variable in order on the PDV, you can use */
/* a variable list to reduce coding on the PUT statement. For example, */
/* PUT poname (zip -- x) (+(-1),'~'); */
/* will generate the same output as the example below. */
data _null_;
set sashelp.zipcode (keep= poname zip y x obs=9);
/* Route the output to the SAS log */
file log dlm='~';
put poname zip y x;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
OUTPUT to SAS log
Lake Clark National Preserve~1~60.815911~-155.623612
Yukon Flats NWR~2~64.714503~-152.700082
Alaska Penninsula NWR~3~57.439057~-156.539678
Lake Clark National Park~4~59.761927~-153.425076
Denali National Park~6~62.466835~-149.313633
Artic National Park~7~69.394856~-151.284365
Outer Ketchikan Misty Fj~8~55.013637~-130.736835
Yukon Delta NWR~10~62.251142~-162.525538
Kenai Fjord Natl Park~11~59.866475~-150.502732
Generate a file whose values are separated by the specified delimiter.
Type: | Sample |
Topic: | SAS Reference ==> DATA Step Common Programming Tasks ==> Reading and Writing External Data
|
Date Modified: | 2005-12-08 11:34:08 |
Date Created: | 2004-09-30 14:08:57 |
Operating System and Release Information
SAS System | Base SAS | All | n/a | n/a |