PxWeb API from SAS?

147 views
Skip to first unread message

Lars K.

unread,
Aug 14, 2023, 4:17:13 AM8/14/23
to pcaxis
Hi 

I have some colleagues who would like to get data from (Swedens) PxWeb API into SAS, and I was wondering if any of you would have a SAS-code example on how to do this?

Looking forward to seeing some of you in Riga :-)

Regards

Lars K.

Jesper Ellemose - Danmarks Statistik

unread,
Aug 15, 2023, 1:27:09 AM8/15/23
to pcaxis
Why not use R? There are packages for that! Or use R to extract the data and then put it into SAS?

Lars Pedersen

unread,
Aug 15, 2023, 5:01:01 AM8/15/23
to pca...@googlegroups.com
URL, below is a saved query with .relational_table as suffix

filename out TEMP; 
filename hdrs TEMP;

proc http
out=out
headerout=hdrs;
run;

proc import datafile=out 
out=scb replace
     dbms=dlm ;
     delimiter='09'x;
     datarow=5;
run;

Hans Baumgartner

unread,
Aug 17, 2023, 3:06:33 AM8/17/23
to pca...@googlegroups.com

This was a great idea … Thanks

If you have problems with Scandinavian characters in variable names add
validvarname=any;

 

Also had to remove the semicolon at the end of the URL line.

 

Hans

 

Lähettäjä: pca...@googlegroups.com <pca...@googlegroups.com> Puolesta Lars Pedersen
Lähetetty: tiistai 15. elokuuta 2023 12.01
Vastaanottaja: pca...@googlegroups.com
Aihe: Re: PxWeb API from SAS?

--
You received this message because you are subscribed to the Google Groups "pcaxis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pcaxis+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pcaxis/VI1PR08MB3838ED2BD99D75BB9FD066BFAF14A%40VI1PR08MB3838.eurprd08.prod.outlook.com.

Lars Pedersen

unread,
Aug 17, 2023, 5:08:10 AM8/17/23
to pca...@googlegroups.com
Yes, Hans

And by the Way, often in a sas program you want to use codes, rather than text strings in the observations. So remember to change from text to code before saving your query.

Makes life in sas easier 

Best 

Sendt fra Outlook til iOS

Fra: pca...@googlegroups.com <pca...@googlegroups.com> på vegne af Hans Baumgartner <hans.bau...@stat.fi>
Sendt: Thursday, August 17, 2023 9:06:27 AM
Til: pca...@googlegroups.com <pca...@googlegroups.com>
Emne: VS: PxWeb API from SAS?
 

Hans Baumgartner

unread,
Aug 17, 2023, 5:37:49 AM8/17/23
to pca...@googlegroups.com
HI,

Nice tip …


The options for the saved queries:

File formats:

.px

.xlsx

.xlsx_doublecolumn (text ja code)

.csv_tabhead

.csv_comma

.csv_commahead

.csv_space

.csv_spacehead

.csv_semicolon

.csv_semicolonhead

.json_stat

.json_stat2

.html5_table

.relational_table        

 

Language:

?lang=fi

?lang=sv

?lang=en

 

Goes to the selection window of PxWeb with selections ready for the table:

?select

 


Hans


 

Lähettäjä: pca...@googlegroups.com <pca...@googlegroups.com> Puolesta Lars Pedersen

Lähetetty: torstai 17. elokuuta 2023 12.08

Lars K.

unread,
Aug 21, 2023, 3:49:50 AM8/21/23
to pcaxis
Thanks a lot for the suggestions and examples. This was exactly what we needed to know :-)

Lars

Lars Pedersen

unread,
Dec 20, 2023, 6:46:11 AM12/20/23
to pcaxis

Hi,

 

I am trying to add a transparent png as logo for charts.

 

Is it fixed to gif?

 

😊 LarsP

 

 

 

asa.a...@scb.se

unread,
Dec 20, 2023, 7:14:28 AM12/20/23
to pca...@googlegroups.com

Hi,

I got the same message when the file wasn’t in Resources/Images but when I put it there the message disappeared.

 

The message didn’t show when I changed to a .png-file that was in the same folder.

 

 

Is your file in the right folder Lars?

 

Kind regards

Åsa

_____

 

Åsa Arrhén

 

Communication Unit

Statistics Sweden

 

Solna strandväg 86, Solna

+46 10 479 44 57

scb.se

 

Från: pca...@googlegroups.com <pca...@googlegroups.com> För Lars Pedersen
Skickat: den 20 december 2023 12:46
Till: pcaxis <pca...@googlegroups.com>
Ämne: logotype in charts ... gif only ?

 

OBS! Detta mejl kommer från en prenumerationslista utanför SCB:s IT-miljö. Önskar ni inte längre ha dessa mejl så kan ni själv nu avprenumerera via länken här. SCB använder en extern tjänst så man avprenumererar sig på ett säkrare sätt. Rapportera till Servicedesk via Spam i Outlook om du misstänker e-posten.



Click here to unsubscribe.

OBS! Detta mejl kommer från en avsändare utanför SCB:s IT-miljö. Klicka inte på länkar och öppna inte bifogade filer om du är osäker på avsändare eller innehåll. Rapportera till Servicedesk via Spam i Outlook om du misstänker e-posten.

--
You received this message because you are subscribed to the Google Groups "pcaxis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pcaxis+un...@googlegroups.com.

Lars Pedersen

unread,
Dec 20, 2023, 7:23:17 AM12/20/23
to pca...@googlegroups.com

Thank you, so much. You were right -it was in the old- version ( I am updating to 2023v1 now)

 

😊 LarsP

Reply all
Reply to author
Forward
0 new messages