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.
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.
Thats not how proc transpose works.
Please post a reproducible example.
@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.
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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.