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 8455663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:20:30+00:00 2026-06-10T12:20:30+00:00

Supose i have a macro variable that is a list of words %LET myvariable=

  • 0

Supose i have a macro variable that is a list of words

%LET myvariable= Avocado Banana Rice Corn Mango Milk Strawberry Banana Banana Lime;

Now, i wish to have a dataset where each row is one word of that list, plus a ID number

ID    Ingredient
1     Avocado
2     Banana
3     Rice
4     Corn
5     Mango
6     Milk
7     Strawberry
8     Banana
9     Banana
10    Lime

I tried something like this:

DATA food;
DO id = 1 TO 10;
Ingredient= SCAN(&myvariable.,id,' ');
    OUTPUT;
END;
RUN;

But this generated an error: “ERROR 388-185: Expecting an arithmetic operator.”

This seems like a trivial thing to do, but somehow i’m stuck. So any help would be greatly appreciated.

Some background:

In my real dataset, this macro variable is created via an PROC SQL, from a dataset where each entry have several words, separated by an space. Something like this:

Product_ID    Ingredients
1             Sugar Milk Vanilla
2             Corn Sugar Banana
3             Apple Banana Maple_Syrup Oats
...           ...
  • 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-10T12:20:32+00:00Added an answer on June 10, 2026 at 12:20 pm

    Very close. Without commenting on why you want to do this, you just need to put double-quotes around your macro variable name:

    DATA food;
       DO id = 1 TO 10;
          Ingredient= SCAN("&myvariable.",id,' ');
          OUTPUT;
       END;
    RUN;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Supose I have a WCF service which sends List serialized with protobuf-net. That function
Supose I have a matrix. This matrix is blank except some points that create
Suppose I have a large list of words. For an example: >>> with open('/usr/share/dict/words')
Suppose I have a C++ macro CATCH to replace the catch statement and that
Suppose that I have recorded a long macro with many commands and special characters.
Let's suppose I have a C extension function that does something that is completely
Supose I have this string: a= hello world hella warld and I want to
Supose i have name Mink,Mark,Aashis . How do compare them and arrange them according
Supose we have a very simple model: Station has at least one Train Train
Suppose I have a pure virtual method in the base interface that returns to

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.