Published on :
ETL, Reporting CREATION_INTERNE

Creation and Display of City-Weather Data

This code is also available in: Deutsch Español Français
Awaiting validation
The script initializes a SAS© library named 'stat' pointing to a system path '/home/u4029796/SASClass'. Two DATA steps are then executed. The first creates the 'stat.Punjab' dataset using column input (INPUT) to import raw data, implicitly defining 'month' as a numeric variable. The second DATA step creates 'stat.Punjab1', similar to the first, but it explicitly forces the 'month' variable to be read as a character type variable ('$'). This illustrates a difference in data interpretation. The datasets are then displayed via 'PROC PRINT' with descriptive titles to visualize the results and potential differences due to the 'month' variable type.
Data Analysis

Type : CREATION_INTERNE


Raw data is included directly in the SAS script via DATALINES blocks for the 'stat.Punjab' and 'stat.Punjab1' datasets.

1 Code Block
DATA STEP Data
Explanation :
This block defines the SAS library 'stat' and then creates a permanent SAS dataset 'stat.Punjab'. It reads raw data by columns (INPUT) defining 'Town' as character, 'Zip', 'day', 'month', 'year', 'temperature' as numeric. Data is provided inline via DATALINES.
Copied!
1LIBNAME stat '/home/u4029796/SASClass';
2DATA stat.Punjab;
3 INPUT Town $ 1-10 Zip 12-17 day 20-21 month 23-24
4 year 26-29 temperature 32-33;
5 DATALINES;
6Ludhiana 141101 02 01 2015 52
7Amritsar 142001 13 06 2015 28
8Bathinda 152875 05 8 2016 43
9Patiala 187525 25 07 2015 20
10Machhiwara 352852 08 2 2016 05
11Mohali 152845 05 05 2016 15
12;
13RUN;
2 Code Block
PROC PRINT
Explanation :
This procedure displays the content of the 'stat.Punjab' dataset in the output window, with the title 'Punjab data set'.
Copied!
1 
2PROC PRINT
3DATA=stat.Punjab;
4TITLE 'Punjab
5data set';
6RUN;
7 
3 Code Block
DATA STEP Data
Explanation :
This block recreates the 'stat' library (although already defined) and creates a new permanent dataset 'stat.Punjab1'. It reads the same raw data as before, but this time, the 'month' variable is explicitly defined as a character type variable ('$'), unlike in the first DATA step where it was numeric. Data is also provided inline via DATALINES.
Copied!
1LIBNAME stat '/home/u4029796/SASClass';
2DATA stat.Punjab1;
3 INPUT Town $ 1-10 Zip 12-17 day 20-21 month $ 23-24
4 year 26-29 temperature 32-33;
5 DATALINES;
6Ludhiana 141101 02 01 2015 52
7Amritsar 142001 13 06 2015 28
8Bathinda 152875 05 8 2016 43
9Patiala 187525 25 07 2015 20
10Machhiwara 352852 08 2 2016 05
11Mohali 152845 05 05 2016 15
12;
13RUN;
4 Code Block
PROC PRINT
Explanation :
This procedure displays the content of the 'stat.Punjab1' dataset in the output window, with the title 'Punjab1 data set'. This allows for comparison of the data presentation with that of the 'stat.Punjab' dataset, particularly for the 'month' variable.
Copied!
1 
2PROC PRINT
3DATA=stat.Punjab1;
4TITLE 'Punjab1
5data set';
6RUN;
7 
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.