BookmarkSubscribeRSS Feed
BCNAV
Quartz | Level 8

Has anyone written a macro/guide to automatically download specified vectors from Statistics Canada?

 

Suppose I want, as an example, v125190 v125221, is there a way to automate this?  Note these are vectors with data and not tables.

 

Thx

 

 

4 REPLIES 4
Tom
Super User Tom
Super User

How do you access it now?  Does it have a URL? Some other method?

BCNAV
Quartz | Level 8

I would go to this page and get a CSV

 

1. https://www150.statcan.gc.ca/t1/tbl1/en/sbv.action#tables

2. Where it says enter vector numbers enter them in separated by commas, then choose 3,000 as the number of reference periods, then download manually

3. Load into SAS.

 

This is not an automated approach....so I thought I would ask

Tom
Super User Tom
Super User

So clicking around it looks like you can download a ZIP file with the data for one of those directly.

https://www150.statcan.gc.ca/n1/en/tbl/csv/24100041-eng.zip

 

Not sure whether it is always going to use that 24100041 number for this "vector".

The ZIP file has two files. From the names it looks like one is the data and the other is the description of the data.

Reeza
Super User

I wrote a macro to get all data at one point, not specific vectors. 

It's in the Canadian subforum. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 926 views
  • 0 likes
  • 3 in conversation