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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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