SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

How to make Proc Transpose scan all the rows-So that it does not say no variable found

Accepted Solution Solved
Reply
Contributor
Posts: 37
Accepted Solution

How to make Proc Transpose scan all the rows-So that it does not say no variable found

Hello Experts,

I am trying to transpose a simple yet large dataset where for all the VAR- columns only last few ROWS are filled with the values.

 

i.e. Ex. my dataset has 10 variables and 500 rows. Out of 10 variables few I want to transpose which is ok, but for all such VAR my data starts from say row number 400. 

 

So my doubt is that the transpose procedure is scanning first few rows for the data but it does not find anything and hence does not transpose them.

And shows this in log:

 

NOTE: No variables to transpose.

Any suggestions on how to override this default behaviour. And make sas scan all rows to search for available data just as sacntext in porc import.

 

 

Thanks.

 

Harshad M.


Accepted Solutions
Solution
‎05-24-2016 05:01 AM
Contributor
Posts: 37

Re: How to make Proc Transpose scan all the rows-So that it does not say no variable found

Posted in reply to HarshadMadhamshettiwar

As a quick way round. I created a dummy row at the top and read the data first in wide format. 

Now all my variable are read in the desired format.

Just before transposing I am deleting _n_=1 and then you are good to go and have long dataset.

 

I think that was the problem with how the data is being read and not the transpose, as it displayed according to its innate & correct behaviour.

 


Thanks.

 

Harshad M.

 

View solution in original post


All Replies
Super User
Posts: 19,772

Re: How to make Proc Transpose scan all the rows-So that it does not say no variable found

Posted in reply to HarshadMadhamshettiwar

Thats not how proc transpose works.

 

Please post a reproducible example.

Super User
Posts: 11,343

Re: How to make Proc Transpose scan all the rows-So that it does not say no variable found

Posted in reply to HarshadMadhamshettiwar

HarshadMadhamshettiwar wrote:

Hello Experts,

I am trying to transpose a simple yet large dataset where for all the VAR- columns only last few ROWS are filled with the values.

 

i.e. Ex. my dataset has 10 variables and 500 rows. Out of 10 variables few I want to transpose which is ok, but for all such VAR my data starts from say row number 400. 


If your data set has records you do not want you can use dataset options on the input dataset to restrict processing.

 

Proc transpose data=mydata (firstobs=400) ...

Says to use the data set starting with observation number 400.

You could also specify other criteria using the WHERE= option to select or exclude records based on values of variables.

 

Solution
‎05-24-2016 05:01 AM
Contributor
Posts: 37

Re: How to make Proc Transpose scan all the rows-So that it does not say no variable found

Posted in reply to HarshadMadhamshettiwar

As a quick way round. I created a dummy row at the top and read the data first in wide format. 

Now all my variable are read in the desired format.

Just before transposing I am deleting _n_=1 and then you are good to go and have long dataset.

 

I think that was the problem with how the data is being read and not the transpose, as it displayed according to its innate & correct behaviour.

 


Thanks.

 

Harshad M.

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 370 views
  • 6 likes
  • 3 in conversation