03-08-2015 05:51 PM
I have a string and want to segregate the string into a dataset.
String=A1 A2 A3 A4 ACCT_ID ACCOUNT_NUMBER CUST_NO.
My Dataset look like this
I tried using below code using macro but it's creating column rather than row.
do i=1 to z;
Let me know the solutionperer
03-09-2015 08:56 AM
Question does not make much sense.
Do you want to create a data set with those variables? If so then were is the data? But without data you will have no rows in the dataset.
03-09-2015 09:07 AM
Here is an approach ... but you don't really tell us where to find the incoming STRING. I'll assume it's in a macro variable:
length variable_name $ 32;
do _n_=1 to 7;
variable_name = scan("&string", _n_, ' ');
If this is a simplified program, and the list of variable names is actually much longer and difficult to count, the program can be modified to acccommodate that.
03-14-2015 03:04 PM
The following code also generate the desired output.
a='A1 A2 A3 A4 ACCT_ID ACCOUNT_NUMBER CUST_NO';
do i = 1 to 7;
drop a i;
proc print data=inc1;
03-14-2015 04:42 PM
Does your data look like this?
length a1 a2 a3 a4 acct_id cust $30;
input a1 /a2 / a3 / a4 / acct_id / acc_num / cust;
proc print; run;