SASEBLS Interface Engine

Example 23.12 Retrieving American Time Use Survey (ATUS) Data

This example shows how to retrieve American Time Use Survey (ATUS) data. You can view these data by using the following URL:

https://www.bls.gov/tus/database.htm

INSERIES is an input SAS data set that lists the IDs of the time series to be read from the ATUS 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 to retrieve using their IDs. In this example, four time series are requested.

The date range of the data starts with 2009, as specified by the STARTYEAR= option. The ENDYEAR= option specifies the last year, 2019, to include in the range of data to retrieve. The FREQ=ANNUAL (or FREQ=A) option specifies the selection of annual data. The ASPECTS=TRUE option is specified, and the data that are retrieved show the standard error, name_aspects, and the value, value_aspects, that are associated with each observation of each time series. The FORMAT= option specifies that the data are to be retrieved using the JSON format. Output 23.12.1 shows the data that are retrieved. Output 23.12.2 shows the catalog information for the retrieved data. Output 23.12.3 shows the aspects information for the retrieved data.


options validvarname=any;
libname blscat "%sysget(BLS)";     /* for Catalog data set*/

DATA inseries;
   length seriesid $ 32;
   seriesid = 'TUU10101AA01001181'; output;
   seriesid = 'TUU10101AA01001260'; output;
   seriesid = 'TUU20101AA01002999'; output;
   seriesid = 'TUU20101AA01003084'; output;
RUN;

title 'Retrieve American Time Use Survey Data';
libname bls sasebls "%sysget(BLS)"
   USER='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
   SETNAME=ATUS
   INSET=inseries
   PAYPATH= "%sysget(BLS)payload"
   OUTJSON=blsex12
   STARTYEAR='2009'
   ENDYEAR='2019'
   FREQ=Annual
   ASPECTS=true
   CATALOG=true
   FORMAT=json;

data myTUS;
   set bls.blsex12;
run;
proc contents data=myTUS; run;
proc print data=myTUS; run;

Output 23.12.1: American Time Use Survey Data

Retrieve American Time Use Survey Data

ObsyearperiodperiodNameTUU10101AA01001181TUU10101AA01001260TUU20101AA01002999TUU20101AA01003084
12009A01Annual0.290.777.906.97
22010A01Annual0.320.797.827.14
32011A01Annual0.310.798.007.21
42012A01Annual0.280.758.077.16
52013A01Annual0.330.807.977.08
62014A01Annual0.340.828.147.28
72015A01Annual0.350.837.917.21
82016A01Annual0.350.828.047.11
92017A01Annual0.360.838.057.24
102018A01Annual0.370.807.887.31
112019A01Annual0.390.797.977.17


The following statements print the catalog data shown in Output 23.12.2:

libname blscat "%sysget(BLS)";

data myCAT;
   set blscat.blsex12_catalog;
run;

proc print data=myCAT; run;

Output 23.12.2: Catalog for American Time Use Survey Data

Retrieve American Time Use Survey Data

Obsordinal_seriesordinal_catalogseries_titleseries_idseasonalitysurvey_namesurvey_abbreviationmeasure_data_typecps_labor_force_statusdemographic_agedemographic_racedemographic_genderdemographic_childrendemographic_educationcps_family_childrencps_activityday_of_weekearnings
111Avg hrs per day - Food preparation and cleanup, MenTUU10101AA01001181Not Seasonally AdjustedAmerican Time UseTUAverage hours per dayAll persons15 years and overAll racesMenAll personsAll education levelsAll personsFood preparation and cleanupAll daysAll persons
222Avg hrs per day - Food preparation and cleanup, WomenTUU10101AA01001260Not Seasonally AdjustedAmerican Time UseTUAverage hours per dayAll persons15 years and overAll racesWomenAll personsAll education levelsAll personsFood preparation and cleanupAll daysAll persons
333Avg hrs per day for participants - Working, Employed, MenTUU20101AA01002999Not Seasonally AdjustedAmerican Time UseTUAverage hours per day for participants in an activityEmployed15 years and overAll racesMenAll personsAll education levelsAll personsWorkingAll daysAll persons
444Avg hrs per day for participants - Working, Employed, WomenTUU20101AA01003084Not Seasonally AdjustedAmerican Time UseTUAverage hours per day for participants in an activityEmployed15 years and overAll racesWomenAll personsAll education levelsAll personsWorkingAll daysAll persons


The following statements print the aspects data as shown in Output 23.12.3. Each time series has its own corresponding name aspects and value aspects time series. The first series, TUU10101AA01001181, has the corresponding name aspects time series TUU10101AA01001181_name_aspects, and it also has the corresponding value aspects time series TUU10101AA01001181_value_aspects. This naming convention, where the time series name also appears as a prefix in the name aspects and value aspects series names, is used for each of the retrieved series.

libname blscat "%sysget(BLS)";

data myASPECTS;
   set blscat.blsex12_data_aspects;
run;

proc print data=myASPECTS; run;

Output 23.12.3: Aspects Output for American Time Use Survey Data

Retrieve American Time Use Survey Data

ObsyearperiodperiodNameTUU10101AA01001181TUU10101AA01001181_name_aspTUU10101AA01001181_val_aspTUU10101AA01001260TUU10101AA01001260_name_aspTUU10101AA01001260_val_aspTUU20101AA01002999TUU20101AA01002999_name_aspTUU20101AA01002999_val_aspTUU20101AA01003084TUU20101AA01003084_name_aspTUU20101AA01003084_val_asp
12009A01Annual0.29Standard Error0.0100.77Standard Error0.0137.90Standard Error0.0766.97Standard Error0.059
22010A01Annual0.32Standard Error0.0090.79Standard Error0.0157.82Standard Error0.0727.14Standard Error0.079
32011A01Annual0.31Standard Error0.0100.79Standard Error0.0178.00Standard Error0.0747.21Standard Error0.067
42012A01Annual0.28Standard Error0.0090.75Standard Error0.0148.07Standard Error0.0797.16Standard Error0.077
52013A01Annual0.33Standard Error0.0110.80Standard Error0.0147.97Standard Error0.0787.08Standard Error0.072
62014A01Annual0.34Standard Error0.0110.82Standard Error0.0168.14Standard Error0.0807.28Standard Error0.069
72015A01Annual0.35Standard Error0.0130.83Standard Error0.0167.91Standard Error0.0787.21Standard Error0.083
82016A01Annual0.35Standard Error0.0120.82Standard Error0.0178.04Standard Error0.0747.11Standard Error0.080
92017A01Annual0.36Standard Error0.0120.83Standard Error0.0228.05Standard Error0.0727.24Standard Error0.088
102018A01Annual0.37Standard Error0.0130.80Standard Error0.0177.88Standard Error0.0837.31Standard Error0.081
112019A01Annual0.39Standard Error0.0120.79Standard Error0.0167.97Standard Error0.0837.17Standard Error0.091


Last updated: July 09, 2026