Australian Bureau of Statistics

Rate the ABS website
ABS Home > Statistics > By Catalogue Number
ABS @ Facebook ABS @ Twitter ABS RSS ABS Email notification service
1406.0.55.002 - User Manual: ABS Remote Access Data Laboratory (RADL), Mar 2006  
Latest ISSUE Released at 11:30 AM (CANBERRA TIME) 22/02/2012  Reissue
   Page tools: Print Print Page Print all pages in this productPrint All RSS Feed RSS Bookmark and Share Search this Product  
Contents >> Frequently asked questions >> Sample code and using CURFs

SAMPLE CODE AND USING CURFS

How do I generate a cross-tabulation?
How do I create ranges in my data?
How do I save a dataset I have created from a CURF?
Can I merge two levels within a CURF?
Can I merge two CURFs?
What is the difference between unit record data and aggregate data?

How do I generate a cross-tabulation?
The following are examples of how to run a cross-tabulation in each language:

SAS
proc freq data=LIBNAME.CURFLEVEL1 ;
table VARIABLE1*VARIABLE2*VARIABLE3 ;
format VARIABLE1 FORMAT1. VARIABLE2 FORMAT2. VARIABLE3 FORMAT3. ;
weight WEIGHT;
run;

SPSS
get file=CURFLEVEL1.
weight by WEIGHT.
execute.

crosstabs
/tables=VARIABLE1 by VARIABLE2 by VARIABLE3
/formats=avalue tables
/cells=counts.

Stata
use "`CURFLEVEL1 '"
table VARIABLE1 VARIABLE2 VARIABLE3

How do I create ranges in my data?
The following are examples of how to create ranged data in each language using the age variable:

SAS
You can create ranged data within SAS by using the Proc Format function.

proc format;
value agef
low - 14 = 'under 15'
15 - 24 = '15-19'
25 - 34 = '25-34'
35 - 44 = '35-44'
45 - 54 = '45-54'
55 - 64 = '55-64'
65 - 74 = '65-74'
75 - 84 = '75-84'
85 - high = '85+';

proc freq data = LIBNAME.CURFLEVEL1;
table age;
format age agef. ;
run;

SPSS
You can create ranged data within SPSS by using the Recode function.

get file=CURFLEVEL1.
execute.

recode AGE (LO thru 14=1) (15 thru 24=2) (25 thru 34=3) (35 thru 44=4)
(45 thru 54=5) (55 thru 64=6) (65 thru 74=7) (75 thru 84=8) (85 thru HI=9) into AGEGRP.
variable labels AGEGRP 'Age Group'.
execute.
value labels AGEGRP 1 'under 15', 2 '15-19', 3 '25-34', 4 '35-44',
5 '45-54', 6 '55-64', 7 '65-74', 8 '75-84', 9 '85+'.

frequencies variables=AGEGRP
/statistics=minimum maximum mode
/order=analysis.

Stata
You can create ranged data within Stata by using the Recode function.

use "`CURFLEVEL1'"

generate agegroup = age
label variable agegroup "Age Group"
recode agegroup (0/14=1) (15/24=2) (25/34=3) (35/44=4) (45/54=5) (55/64=6) (65/74=7) (75/84=8) (85/150=9)
label define agegrouplbl 1 "under 15" 2 "15-19" 3 "25-34" 4 "35-44" 5 "45-54" 6 "55-64" 7 "65-74" 8 "75-84" 9 "85+", modify
label value agegroup agegrouplbl
list agegroup in 1/10

How do I save a dataset I have created from a CURF?
You can save your work in the RADL and then use your saved dataset in a later job. Example code showing you how to save datasets and use saved datasets is in the How to save files to your personal workspace section of the User Manual: ABS Remote Access Data Laboratory (RADL).

Can I merge two levels within a CURF?
You can merge multiple levels of a CURF. This is done by sorting each level by a common ABS unit identifier, then merging by the same identifier. Merged datasets can be saved in your personal workspace in the RADL for later use. For more information about saving, see the How to save files to your personal workspace section of the User Manual: ABS Remote Access Data Laboratory (RADL).

Below are some examples on how to merge two levels within a CURF, using SAS, SPSS or Stata.

SAS:
proc sort data = LIBNAME.CURFLEVEL1 out = psndata;
by ABSHID;
proc sort data = LIBNAME.CURFLEVEL2 out = hhdata;
by ABSHID;

data SAVED.MERGED;
merge psndata hhdata;
by ABSHID;
run;

SPSS:
get file CURFLEVEL1.
sort cases by ABSHID.
get file CURFLEVEL2.
sort cases by ABSHID.
match files file=*
/table=CURFLEVEL1
/by ABSHID.
execute.
save outfile = SAVED'MERGED'.

Stata:

use "`CURFLEVEL1'"
sort ABSHID ABSIID ABSPID ABSFID
save "`SAVED'XTRAVARS", replace

use "`CURFLEVEL2'"
sort ABSHID ABSIID ABSPID
save "`SAVED'NEWVARS", replace

use "`SAVED'NEWVARS"
merge ABSHID ABSIID ABSPID using "`SAVED'XTRAVARS"
save "`SAVED'MERGED", replace

Can I merge two CURFs?
You can merge two CURFs. However, you may only merge aggregate data to unit record data, or aggregate to aggregate data between the CURFs. You must not merge unit record to unit record data across CURFs.

To merge CURFs, in the New Request screen, select more than one CURF in the Microdata window by holding down the Control button on your keyboard. You will also need to reference both CURFs in your code. Alternatively your code can reference a saved dataset from one CURF and reference another CURF that you have selected in the Microdata window. Note that not all CURFs will have the same variable names, so you may need to use renaming commands within your code. Further information about referencing in your code is available in the How to reference the CURF in your code section of the User Manual: ABS Remote Access Data Laboratory (RADL).

What is the difference between unit record data and aggregate data?
Unit record data lists individual values of variables for the record. Aggregate data collapses variables across multiple records. Aggregate data examples include means, medians, ranges or regressions. Unit record data includes individual records from the CURF. Greater protections are placed on unit record data and can limit the output you are able to receive. With aggregate data, the greater the level of aggregation, the greater amount of data you can output. Note that when working with unit record data, ABS unit identifiers must be retained. For further information see Retention of ABS identifiers section of the User Manual: ABS Remote Access Data Laboratory (RADL).

Previous PageNext Page


Bookmark and Share. Opens in a new window


Commonwealth of Australia 2014

Unless otherwise noted, content on this website is licensed under a Creative Commons Attribution 2.5 Australia Licence together with any terms, conditions and exclusions as set out in the website Copyright notice. For permission to do anything beyond the scope of this licence and copyright terms contact us.