Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:23:02+00:00 2026-06-15T15:23:02+00:00

I have a dataset like this Obs MinNo EurNo MinLav EurLav 1 103 15.9

  • 0

I have a dataset like this

Obs MinNo EurNo MinLav EurLav 
1   103    15.9    92    21.9 
2    68    18.5   126    18.5 
3    79    15.9   114    22.3 

My goal is to create a data set like this from the dataset above:

Obs Min    Eur     Lav 
1   103    15.9    No    
2    92    21.9    Yes     
3    68    18.5    No    
4   126    18.5    Yes
5    79    15.9    No
6   114    22.3    Yes

Basically I’m taking the 4 columns and appending them into 2 columns + a Categorical indicating which set of 2 columns they came from

Here’s what I have so far

PROC IMPORT DATAFILE='f:\data\order_effect.xls' DBMS=XLS OUT=orderEffect;
RUN;

DATA temp;
INFILE orderEffect;
INPUT minutes euros @@;
IF MOD(_N_,2)^=0 THEN lav='Yes';
ELSE lav='No';
RUN;

My question though is how I can I import an Excel sheet but then modify the SAS dataset it creates so I can shove the second two columns below the first two and add a third column based on which columns in came from?

I know how to do this by splitting the dataset into two datasets then appending one onto the other but with the mode function above it would be a lot faster.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:23:03+00:00Added an answer on June 15, 2026 at 3:23 pm

    You were very close, but misunderstanding what PROC IMPORT does.

    When PROC EXPORT completes, it will have created a SAS data set named orderEffect containing SAS variables from the columns in your worksheet. You just need to do a little data step program to give the result you want. Try this:

    data want;
    
       /* Define the SAS variables you want to keep */
       format Min 8. Eur 8.1;
       length Lav $3;
       keep Min Eur Lav;
    
       set orderEffect;
    
       Min = MinNo;
       Eur = EurNo;
       Lav = 'No';
       output;
    
       Min = MinLav;
       Eur = EurLav;
       Lav = 'Yes';
       output;
    run;
    

    This assumes that the PROC IMPORT step created a data set with those names. Run that step first to be sure and revise the program if necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataset that looks like this: a <- data.frame(rep(1,5),1:5,1:5) b <- data.frame(rep(2,5),1:5,1:5)
I have the dataset (pts) like this: x <- seq(-124.25,length=115,by=0.5) y <- seq(26.25,length=46,by=0.5) z
i have a dataset that looks like this: Bin Frequency 6.0 0 5.9 0
I have a dataset whose columns look like this: Consumer ID | Product ID
I have a dataset like this: x A B 1 x 2 2 y
I have a dataset something like this: col_a col_b col_c 1 abc_boy 1 2
I have a dataset that looks like this: 0 _ _ 23.0186E-03 10 _
SQL 2008 Basically i have a dataset that looks like this: AcctID AcctType AcctSubType
I have a SAS dataset that looks like this: var _12 _41 _17 12
Suppose I have a SAS dataset that looks like this: id x 1 1234

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.