07-24-2015 04:00 PM
I have some SAS code that applies a Regular Expression to a URL string which pulls out a Category ID.
The Variable looks like this
I apply this code:
I get this:
The data set I have actually has many URL variables – URL_1, URL_2, URL_3….. and so on. It could go up to 80 URL vars or it could be 10.
What I need to do is pull the category IDs out of all the URL vars and then transpose them by Campaign_Name.
The data looks like this.
What I need is this:
07-24-2015 04:08 PM
You'll have to tweak this a bit to deal with when a URL is missing but here's the general idea.
Declare an array to hold the url. Find the Category ID, and then output the records so it transposes in one step. Only keep the variables you need.
array url_array(80) $ url_:;
do i=1 to 80;
keep campaign_name category_id;
PS if your question relates to a previous question its sometimes useful to link back to it.
EDIT: Change to correctly reference array
07-24-2015 04:21 PM
That didn't seem to work for some reason. The category_id ID var came back all null. Is there something wrong with the array?