Skip to main content

A Terminology Map for SQL, R, and SAS

·2 mins

Every language has its own name for the same concept. When you work with data, you usually have a go-to language, but you rarely get to use just one. Bouncing between tools, I’ve noticed that unless I keep the terminology organized somewhere, I end up mixing the terms myself. So this post is my attempt to sort it out once and for all.


Structures #

ConceptSQLRSAS
A tabletabledata.frame, tibble, data.tabledata set
A rowrow, record, tuplerowobservation
A columncolumn, field, attributecolumn, variablevariable
A single valuevalue, cellelement, cellvalue

Verbs #

Rows are in SQL’s logical execution order.

TaskSQLR (dplyr)SAS
Join tablesJOIN*_join(), merge()MERGE
Filter rowsWHEREfilter()WHERE, IF
Group and summarizeGROUP BYgroup_by() + summarize()PROC MEANS, PROC SUMMARY
Create a new columnASmutate()newvar=
Select columnsSELECTselect()KEEP=, DROP=
Remove duplicatesDISTINCTdistinct(), unique()PROC SORT NODUPKEY
SortORDER BYarrange()PROC SORT
Stack verticallyUNIONbind_rows(), rbind()SET

Data Types #

ConceptSQLRSAS
NumbersNUMERIC, INT, FLOAT, DECIMALnumeric (=double), integernumeric
StringsVARCHAR, CHAR, TEXTcharactercharacter
Categorical(none)factor(none)
DatesDATE, TIMESTAMPDate, POSIXctdate
BooleanBOOLEANlogical(none)

Missing Values #

ConceptSQLRSAS
Missing valueNULLNA. (numeric), (character)
Checking for missingIS NULLis.na(x)missing(x), x = .

I’ll keep extending this table as I run into more terminology collisions.