BookmarkSubscribeRSS Feed
ajaykumar0901
Calcite | Level 5

Hi Team,

I was trying to retain the variables from the Specifications which is in XLSX sheet.

Can you please give the hint how to retain the variables.

 

 

7 REPLIES 7
PaigeMiller
Diamond | Level 26

More detail is needed. Explain. Show us the data. How are you getting this Excel file into SAS?

--
Paige Miller
ajaykumar0901
Calcite | Level 5
Actually I was asked in an interview, You can consider any example which
is in excel.

Thanks in advance.

Tom
Super User Tom
Super User

@ajaykumar0901 wrote:
Actually I was asked in an interview, You can consider any example which
is in excel.

Thanks in advance.


I would assume that the Excel file was used as metadata. 

 

So perhaps it had the list of variables that should exist and the question was how to use it to define a dataset that met the specifications.  For example the file might have had a variable named NAME that had the name to use for the variable and LABEL that had the label to attach to the variable and FORMAT that had the format to attach to the variable.  It probably should also have a TYPE and LENGTH value so you set the variable type. Or perhaps the LENGTH metadata is used to specify both by adding a $ before the length of character variables.

 

Or perhaps it had other specifications they want implemented. Perhaps edit checks that should be preformed for certain variables.

 

 

PaigeMiller
Diamond | Level 26

@ajaykumar0901 wrote:

Hi Team,

I was trying to retain the variables from the Specifications which is in XLSX sheet.

Can you please give the hint how to retain the variables.

 

 


I have no idea what "specifications" means in this context.

 

You retain variables using the RETAIN statement.

--
Paige Miller
ajaykumar0901
Calcite | Level 5
Hi Team,

Please find the attachment of excel. Now I have to read the excel file and
the order to be maintained the same.



ballardw
Super User

@ajaykumar0901 wrote:
Hi Team,

Please find the attachment of excel. Now I have to read the excel file and
the order to be maintained the same.




If you attached something it didn't take.

 

If this is supposed to relate to SAS data sets after reading then "order" may be problematic depending on how that spreadsheet is organized. If the rows of the spreadsheet are supposed to describe variables then basically that is not the "order" of variables in a data set as SAS data set variables are from "columns".

Reeza
Super User

Retain in SAS is a type of functionality but it can also be used in laymans terms, e.g keep only these variables.

You'll first want to ensure you have the correct understanding of the question. Can you clarify what type of functionality you're trying to achieve here?

The exact wording of the question is likely important. 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1713 views
  • 0 likes
  • 5 in conversation