BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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.

1 ACCEPTED SOLUTION

Accepted Solutions
HarshadMadhamshettiwar
Obsidian | Level 7

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

3 REPLIES 3
Reeza
Super User

Thats not how proc transpose works.

 

Please post a reproducible example.

ballardw
Super User

@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.

 

HarshadMadhamshettiwar
Obsidian | Level 7

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.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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