SASEBLS Interface Engine
Example 23.15 Retrieving Occupational Requirements Survey (ORS) Data
This example shows how to retrieve data from the Occupational Requirements Survey (ORS). You can view these data by using the following URL:
https://www.bls.gov/ors/data.htm
INSERIES is an input SAS data set that lists the time series IDs to be read from the OR database. In this example, the input SAS data set is named in the INSET=INSERIES option. To create the INSERIES data set, use the DATA step. In the DATA statement, the name of the input data set is specified as 'INSERIES'. Next, the length of the series ID is specified as 32 bytes prior to listing each series ID to be accessed. Each time series is listed on its own line, along with the OUTPUT statement. When the series IDs have been listed, the DATA step is ended with a RUN statement. The following SASEBLS LIBNAME statement specifies the libref (BLS), followed by the engine name (SASEBLS) and the physical path where the retrieved BLS data are to be stored. The OUTJSON= option names the file where the JSON data are stored. The output data set is created using the OUTJSON= option and placed in the folder that is specified in the SASEBLS LIBNAME statement. The INSET= option specifies the INSERIES data set for the list of series IDs to retrieve. In this example, two time series are requested, along with any calculations. The date range of the data starts with 2022, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2022, to include in the range of data to retrieve. The FREQ=ANNUAL (or FREQ=A) option specifies the selection of annual data, and the CATALOG=TRUE option requests that catalog information be retrieved. The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.15.1 shows the data that are retrieved. Output 23.15.2 shows the catalog information for the retrieved data.
options;
libname blscat "%sysget(BLS)"; /* for Catalog data set*/
DATA inseries;
length seriesid $ 32;
seriesid = 'ORUC1000000000001167'; output;
seriesid = 'ORUC1000000000001164'; output;
RUN;
title 'Retrieve Occupational Requirements Survey Data';
libname bls sasebls "%sysget(BLS)"
USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
SETNAME=ORS
INSET=inseries
PAYPATH= "%sysget(BLS)payload"
OUTJSON=blsex15
STARTYEAR='2022'
ENDYEAR='2022'
FREQ=Annual
CATALOG=true
FORMAT=json;
data myORS;
set bls.blsex15;
run;
proc contents data=myORS; run;
proc print data=myORS; run;
Output 23.15.1: Occupational Requirements Survey Data
| Retrieve Occupational Requirements Survey Data |
| Obs | year | period | periodName | ORUC1000000000001164 | ORUC1000000000001167 |
|---|---|---|---|---|---|
| 1 | 2022 | A01 | Annual | 2.4 | 17.1 |
The following statements print the catalog information shown in Output 23.15.2:
proc contents data=blscat.blsex15_catalog; run;
proc print data=blscat.blsex15_catalog; run;
Output 23.15.2: Catalog for Occupational Requirements Survey Data
| Retrieve Occupational Requirements Survey Data |
| Obs | ordinal_series | ordinal_catalog | series_title | series_id | seasonality | survey_name | survey_abbreviation | measure_data_type | commerce_industry | occupation | occupation_work_class | requirements | type_of_cases |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | Percent of civilian workers; workload is controlled by machinery, equipment, or software | ORUC1000000000001164 | Not Seasonally Adjusted | Occupational Requirements Survey | OR | Percentage | All workers | All workers | All workers | Cognitive and mental requirements | Pace: Control of workload |
| 2 | 2 | 2 | Percent of civilian workers; workload is self-paced | ORUC1000000000001167 | Not Seasonally Adjusted | Occupational Requirements Survey | OR | Percentage | All workers | All workers | All workers | Cognitive and mental requirements | Pace: Control of workload |