The main objective of this script is to provide a set of fictitious, self-contained data for demonstrations, tests, or analysis examples. It sequentially defines tables for:
'person': basic demographic information of individuals.
'indlag': details of hospital admissions.
'syghus': hospital names corresponding to their identifiers.
'priser': medical procedure rates with validity periods.
Each DATA STEP block is self-contained and creates a specific table with its appropriate variables and formats. The data is hardcoded via the DATALINES statement.
Data Analysis
Type : CREATION_INTERNE
All data used in this script is internally generated via the DATALINES statement. This means that no external data sources (flat files, databases, etc.) are required for execution. The created datasets are 'person', 'indlag', 'syghus', and 'priser', serving as complete input data for further processing.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the `person` table, which contains basic identity information for four individuals. The variables `CPR` (numeric identifier), `Navn` (textual name), and `By` (textual city) are defined with their respective types and lengths. Data is read via `datalines` with the `dsd` option to handle string delimiters (commas) and quotes.
Copied!
data person;
length CPR 8 Navn By $20;
infile datalines dsd;
input CPR Navn By;
datalines;
0102034567,"Anders","Allerød"
1012625678,"Barbara","Broby"
3111727892,"Charlotte","Charlottenlund"
1706582345,"Dennis","Dalby"
;
run;
1
DATA person;
2
LENGTH CPR 8 Navn BY $20;
3
INFILEDATALINES dsd;
4
INPUT CPR Navn BY;
5
DATALINES;
6
0102034567,"Anders","Allerød"
7
1012625678,"Barbara","Broby"
8
3111727892,"Charlotte","Charlottenlund"
9
1706582345,"Dennis","Dalby"
10
;
11
RUN;
2 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the `indlag` table, which records hospitalization details. It includes the variables `CPR`, `IndDT` (admission date and time, formatted as `datetime32.3`), `Sygh` (hospital identifier), and `Proc` (procedure code). The `datetime32.` informat is used to correctly read date and time values, while the `datetime32.3` format ensures precise display.
Explanation : This DATA STEP block generates the `syghus` table containing the list of hospitals. It associates a numeric hospital identifier (`Sygh`) with its textual name (`Tekst`). Data is directly embedded via `datalines`.
Explanation : This DATA STEP block constructs the `priser` table, which defines medical procedure rates over different validity periods. The variables `Procedure` (procedure code), `FraDato` and `TilDato` (start and end dates of validity, formatted as `date9.`), and `Pris` (price, formatted as `Commax18.2`) are included. The `date9.` informats are used to read dates correctly.
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.