Published on :
ETL CREATION_INTERNE

Creation of sample addresses

This code is also available in: Deutsch Español Français
Awaiting validation
The script initializes a dataset named 'sample_addresses' in the 'sasdm' library. It defines variables for a unique identifier (id), the full address (address), postal code (pc), city, state/province, and country. The actual data is provided directly in the script via the CARDS statement, facilitating the quick creation of a test or example dataset. The INFILE 'dlm="," dsd' options are used to specify the comma delimiter and to handle quotes and commas within text fields.
Data Analysis

Type : CREATION_INTERNE


The data is directly embedded in the SAS script via the CARDS (datalines) statement. No external data source is used.

1 Code Block
DATA STEP Data
Explanation :
This block uses a DATA step to create the 'sample_addresses' dataset. The `length` statement defines the length of character variables to prevent truncation. `infile cards dlm="," dsd` indicates that data is read from the lines following the `cards` statement, with comma as the delimiter and the DSD (Delimiter Sensitive Data) option to handle commas within fields and missing values represented by consecutive delimiters. The `input` statement reads the values into the defined variables. Finally, `run` executes the DATA step.
Copied!
1DATA sasdm.sample_addresses ;
2 LENGTH id 8 address $ 100 pc $ 10 city state country $ 32 ;
3 INFILE CARDS dlm="," dsd ;
4 INPUT id address pc city state country ;
5 CARDS ;
61,100 SAS Campus Dr,27513,,NC,United States
72,385 Bourke St,VIC 3004,Melbourne,VIC,AUS
83,1 Eagle Street,4000,Brisbane,QLD,AUS
94,10188 Telesis Court Suite 200,,San Diego,,USA
105,Domaine de Grégy Grégy-sur-Yerres,77257,,,FRA
116,787 Seventh Ave.,10019,,,United States of America
127,1530 Wilson Blvd. Suite 800,,Arlington,,US
138,Piazza della Repubblica 68,,Roma,,ITA
149,One PPG Place Suite 2950,15222,Pittsburgh,Pennsylvania,US
1510,Via Confienza 10,10121,,,Italia
1611,Monroe Park Towers 101 N. Monroe St. Suite 725,,Tallahassee,FL,U.S.A.
1712,121 W. Trade St.,28202,,,US
1813,Tour Ariane 27ème étage 5 place de la pyramide,92800,PARIS LA DEFENSE,,France
1914,Via Darwin 20/22,20143,,,Italy
2015,111 Rockville Pike Suite 900,20850,,,U.S.A.
2116,300 Burns Bay Road,2066,Lane Cove,,Australia
2217,Two Prudential Plaza 180 N. Stetson St. Suite 1600,60601,,,US
2318,8500 Normandale Lake Blvd. Suite 1200,,Bloomington,,US
2419,15 Viale Ancona,,Venezia-Mestre,,ITALY
25;
26RUN ;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.