Published on :
ETL CREATION_INTERNE

Fahrenheit to Celsius Temperature Conversion

This code is also available in: Deutsch Español Français
Awaiting validation
This program creates a dataset named TEMPERATURE by reading raw values via DATALINES. It uses two arrays: one for Fahrenheit temperatures (TF1-TF10) and the other for storing Celsius conversions (TC1-TC10). A DO loop iterates over these arrays to apply the conversion formula. The result is then displayed in the output report.
Data Analysis

Type : CREATION_INTERNE


Data is included directly in the source code via the DATALINES statement.

1 Code Block
DATA STEP Data
Explanation :
DATA step that reads 10 Fahrenheit temperature values per line, declares two arrays to manipulate columns in an indexed manner, and calculates the corresponding Celsius values.
Copied!
1DATA TEMPERATURE;
2 INPUT TF1-TF10;
3 array TF[10];
4 array TC[10];
5 DO count = 1 to 10;
6 TC[count]=5/9*(TF[count]-32);
7 END;
8 drop count;
9 
10DATALINES;
1132 212 -40 10 20 30 40 50 60 70
12-10 0 10 20 30 40 50 60 70 80
13;
2 Code Block
PROC PRINT
Explanation :
Standard print procedure to view the content of the previously created TEMPERATURE table.
Copied!
1 
2PROC PRINT;
3title 'Problem 15.2 Listing of
4Data Set TEMPERATURE';
5RUN;
6 
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.