DATA Step, Macro, Functions and more

proc sql

Reply
Occasional Contributor
Posts: 10

proc sql

Import smb usage data into sas and provide labels from "Churners and label ' file . (9999 OBSERVATIONS AND 400 VARIABLES )

 

 

I  am only able to import the file

Super User
Posts: 22,823

Re: proc sql

I think the answer is the same as this question. 

 

https://communities.sas.com/t5/Base-SAS-Programming/proc-sql/m-p/406565

Occasional Contributor
Posts: 10

Re: proc sql

this is the second data file

Super User
Super User
Posts: 9,193

Re: proc sql

Sorry, the title of your post bears no resemblance to your post.  You have not provided any clear indication on what your question is.  It appears you have copied part of a question from some test and expect a response.  Please review the guidance on how to post a question to get a good response - from the main page, or by the Post button.  At a guess - as I wouldn't download Excel files from the web, you have data in one tab and labels in another.  If so read in both datasets, then using the one with labels generate a statement to label the data, e.g.:

data _null_;
  set labelstab end=last;
  if _n_=1 then call execute('data want;  set have;');
  call execute('label ',varfromtab,'="',label,'";');
  if last then call execute(';run;');
run;

Alternatively, convert the file into two CSV files - far better data format, then read the labels one into SAS first using a datastep import, then use that data, much like the above, to write the datastep import for the second set of data.  That way you can read the second in directly without need for post processing.

Super User
Super User
Posts: 9,193

Re: proc sql

Sorry, the title of your post bears no resemblance to your post.  You have not provided any clear indication on what your question is.  It appears you have copied part of a question from some test and expect a response.  Please review the guidance on how to post a question to get a good response - from the main page, or by the Post button.  At a guess - as I wouldn't download Excel files from the web, you have data in one tab and labels in another.  If so read in both datasets, then using the one with labels generate a statement to label the data, e.g.:

data _null_;
  set labelstab end=last;
  if _n_=1 then call execute('data want;  set have;');
  call execute('label ',varfromtab,'="',label,'";');
  if last then call execute(';run;');
run;

Alternatively, convert the file into two CSV files - far better data format, then read the labels one into SAS first using a datastep import, then use that data, much like the above, to write the datastep import for the second set of data.  That way you can read the second in directly without need for post processing.

Ask a Question
Discussion stats
  • 4 replies
  • 184 views
  • 0 likes
  • 3 in conversation