inst/QueryLibrary/Aggregate/person/PE07.md

PE07: Number of patients grouped by residence state location

Description

This query is used to count the locations (location_id) across all person records. All possible values for location are summarized.

Query

SELECT
  state    AS state_abbr,
  COUNT(*)::integer AS num_persons
FROM @cdm.person
  LEFT JOIN @cdm.location ON person.location_id = location.location_id
GROUP BY state
ORDER BY state
;

Input

None

Output

| Field | Description | | --- | --- | | state | State of residence | | num_persons | Number of patients in the dataset residing in specific state |

Example output record

| Field | Value | | --- | --- | | state | MA | | num_persons | 1196292 |

Documentation

https://github.com/OHDSI/CommonDataModel/wiki/PERSON

Sensitive fields

num_persons



sib-swiss/dsQueryLibraryServer documentation built on Feb. 13, 2025, 8:07 p.m.